home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Online / ProfiPacket / Profi_Packet / src / acinclude.m4 < prev    next >
Encoding:
M4 Source File  |  1999-05-13  |  84.4 KB  |  3,348 lines

  1. ##   -*- shell-script -*-
  2.  
  3. dnl    This file is part of the KDE libraries/packages
  4. dnl    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
  5. dnl              (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
  6.  
  7. dnl    This file is free software; you can redistribute it and/or
  8. dnl    modify it under the terms of the GNU Library General Public
  9. dnl    License as published by the Free Software Foundation; either
  10. dnl    version 2 of the License, or (at your option) any later version.
  11.  
  12. dnl    This library is distributed in the hope that it will be useful,
  13. dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. dnl    Library General Public License for more details.
  16.  
  17. dnl    You should have received a copy of the GNU Library General Public License
  18. dnl    along with this library; see the file COPYING.LIB.  If not, write to
  19. dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. dnl    Boston, MA 02111-1307, USA.        
  21.  
  22. dnl IMPORTANT NOTE:
  23. dnl Please do not modify this file unless you expect your modifications to be
  24. dnl carried into every other module in the repository. If you decide that you
  25. dnl really want to modify it, contact coolo@kde.org mentioning that you have
  26. dnl and that the modified file should be committed to every module.
  27. dnl
  28. dnl Single-module modifications are best placed in configure.in for kdelibs
  29. dnl and kdebase or configure.in.in if present.
  30.  
  31.  
  32. dnl ------------------------------------------------------------------------
  33. dnl Find a file (or one of more files in a list of dirs)
  34. dnl ------------------------------------------------------------------------
  35. dnl
  36. AC_DEFUN(AC_FIND_FILE,
  37. [
  38. $3=NO
  39. for i in $2;
  40. do
  41.   for j in $1;
  42.   do
  43.     if test -r "$i/$j"; then
  44.       $3=$i
  45.       break 2
  46.     fi
  47.   done
  48. done
  49. ])
  50.  
  51. AC_DEFUN(KDE_FIND_PATH,
  52. [
  53.    AC_MSG_CHECKING([for $1])
  54.    AC_CACHE_VAL(kde_cv_path_$1,
  55.    [
  56.      kde_cv_path_$1="NONE"
  57.      if test -n "$$2"; then
  58.         kde_cv_path_$1="$$2";
  59.      else
  60.     dirs="$3"
  61.     kde_save_IFS=$IFS
  62.     IFS=':'
  63.     for dir in $PATH; do
  64.       dirs="$dirs $dir"
  65.         done
  66.     IFS=$kde_save_IFS
  67.  
  68.         for dir in $dirs; do
  69.       if test -x "$dir/$1"; then
  70.         if test -n "$5"
  71.         then
  72.               evalstr="$dir/$1 $5 2>&1 "
  73.           if eval $evalstr; then
  74.                 kde_cv_path_$1="$dir/$1"
  75.                 break
  76.           fi
  77.             else
  78.         kde_cv_path_$1="$dir/$1"
  79.                 break
  80.         fi
  81.           fi
  82.     done
  83.  
  84.      fi
  85.          
  86.    ])
  87.  
  88.    if test -z "$kde_cv_path_$1" || test "$kde_cv_path_$1" = "NONE"; then
  89.       AC_MSG_RESULT(not found)
  90.       $4
  91.    else 
  92.      AC_MSG_RESULT($kde_cv_path_$1)
  93.      $2=$kde_cv_path_$1
  94.    fi
  95. ])
  96.  
  97. AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
  98. [
  99.     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
  100. Please check whether you installed Qt correctly. 
  101. You need to have a running moc binary.
  102. configure tried to run $ac_cv_path_moc and the test didn't
  103. succeed. If configure shouldn't have tried this one, set
  104. the environment variable MOC to the right one before running
  105. configure.
  106. ])
  107. ])
  108.  
  109. dnl ------------------------------------------------------------------------
  110. dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some
  111. dnl more usual places
  112. dnl ------------------------------------------------------------------------
  113. dnl
  114. AC_DEFUN(AC_PATH_QT_MOC,
  115. [
  116.    KDE_FIND_PATH(moc, MOC, [$ac_qt_bindir $QTDIR/bin $QTDIR/src/moc \
  117.         /usr/bin /usr/X11R6/bin /usr/lib/qt/bin \
  118.         /usr/local/qt/bin], [KDE_MOC_ERROR_MESSAGE])
  119.  
  120.    if test -z "$MOC"; then
  121.      if test -n "$ac_cv_path_moc"; then
  122.        output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"`
  123.      fi
  124.      echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC
  125.      echo "configure:__oline__: moc output: $output" >&AC_FD_CC
  126.  
  127.      if test -z "$output"; then
  128.        KDE_MOC_ERROR_MESSAGE
  129.     fi
  130.    fi
  131.    
  132.    AC_SUBST(MOC)
  133. ])
  134.  
  135. AC_DEFUN(KDE_CHECK_PATH_HEADERS,
  136. [
  137.     AC_MSG_CHECKING([for KDE headers installed])
  138.     AC_LANG_SAVE
  139.     AC_LANG_CPLUSPLUS
  140. cat > conftest.$ac_ext <<EOF
  141. #include <stdio.h>
  142. #include "confdefs.h"
  143. #include <kapp.h>
  144.  
  145. int main() {
  146.     printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
  147.     printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
  148.     printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
  149.     printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
  150.     printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
  151.     printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
  152.     printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
  153.     printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
  154.     printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
  155.     printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
  156.     printf("kde_wallpaperdir=\\"%s\\"\n", 
  157.     KApplication::kde_wallpaperdir().data());
  158.     printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
  159.     printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
  160.     return 0;
  161.     }
  162. EOF
  163.  
  164. ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
  165. if AC_TRY_EVAL(ac_compile); then
  166.   AC_MSG_RESULT(yes)
  167. else
  168.   AC_MSG_ERROR([your system is not able to compile a small KDE application!
  169. Check, if you installed the KDE header files correctly.])
  170. fi
  171. AC_LANG_RESTORE
  172. ])
  173.  
  174. AC_DEFUN(AC_CREATE_KFSSTND,
  175. [
  176. AC_REQUIRE([AC_CHECK_RPATH])
  177. AC_REQUIRE([AC_CHECK_BOOL])
  178. AC_REQUIRE([KDE_CHECK_LIBDL])
  179. AC_REQUIRE([KDE_PROG_LIBTOOL])
  180.  
  181. AC_MSG_CHECKING([for KDE paths])
  182. kde_result=""
  183.  
  184. AC_CACHE_VAL(kde_cv_all_paths,
  185. [
  186. if test "$1" = "default"; then
  187.  
  188.   if test -z "$kde_htmldir"; then
  189.     kde_htmldir='\$(prefix)/share/doc/HTML'
  190.   fi
  191.   if test -z "$kde_appsdir"; then
  192.     kde_appsdir='\$(prefix)/share/applnk'
  193.   fi
  194.   if test -z "$kde_icondir"; then
  195.     kde_icondir='\$(prefix)/share/icons'
  196.   fi
  197.   if test -z "$kde_sounddir"; then
  198.     kde_sounddir='\$(prefix)/share/sounds'
  199.   fi
  200.   if test -z "$kde_datadir"; then
  201.     kde_datadir='\$(prefix)/share/apps'
  202.   fi
  203.   if test -z "$kde_locale"; then
  204.     kde_locale='\$(prefix)/share/locale'
  205.   fi
  206.   if test -z "$kde_cgidir"; then
  207.     kde_cgidir='\$(exec_prefix)/cgi-bin'
  208.   fi
  209.   if test -z "$kde_confdir"; then
  210.     kde_confdir='\$(prefix)/share/config'
  211.   fi
  212.   if test -z "$kde_mimedir"; then
  213.     kde_mimedir='\$(prefix)/share/mimelnk'
  214.   fi
  215.   if test -z "$kde_toolbardir"; then
  216.     kde_toolbardir='\$(prefix)/share/toolbar'
  217.   fi
  218.   if test -z "$kde_wallpaperdir"; then
  219.     kde_wallpaperdir='\$(prefix)/share/wallpapers'
  220.   fi
  221.   if test -z "$kde_bindir"; then
  222.     kde_bindir='\$(exec_prefix)/bin'
  223.   fi
  224.   if test -z "$kde_partsdir"; then
  225.     kde_partsdir='\$(exec_prefix)/parts'
  226.   fi
  227.  
  228.   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
  229.     kde_htmldir=\"$kde_htmldir\" \
  230.     kde_appsdir=\"$kde_appsdir\" \
  231.     kde_icondir=\"$kde_icondir\" \
  232.     kde_sounddir=\"$kde_sounddir\" \
  233.     kde_datadir=\"$kde_datadir\" \
  234.     kde_locale=\"$kde_locale\" \
  235.     kde_cgidir=\"$kde_cgidir\" \
  236.     kde_confdir=\"$kde_confdir\" \
  237.     kde_mimedir=\"$kde_mimedir\" \
  238.     kde_toolbardir=\"$kde_toolbardir\" \
  239.     kde_wallpaperdir=\"$kde_wallpaperdir\" \
  240.     kde_bindir=\"$kde_bindir\" \
  241.     kde_partsdir=\"$kde_partsdir\" \
  242.     kde_result=defaults"
  243.  
  244. else 
  245.  
  246. AC_MSG_RESULT([compiling])
  247.  
  248. KDE_CHECK_PATH_HEADERS
  249.  
  250. KDE_TEST_RPATH=
  251.  
  252. if test -n "$USE_RPATH"; then
  253.  
  254.   if test -n "$kde_libraries"; then
  255.     KDE_TEST_RPATH="-rpath $kde_libraries"
  256.   fi
  257.  
  258.   if test -n "$qt_libraries"; then
  259.     KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries"
  260.   fi
  261.  
  262.   if test -n "$x_libraries"; then
  263.     KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries"
  264.   fi
  265.  
  266.   KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
  267. fi
  268.  
  269. AC_MSG_CHECKING([for KDE libraries installed])
  270. ac_link='/bin/sh ./libtool --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBDL $LIBQT $KDE_TEST_RPATH 1>&5'
  271.  
  272. if AC_TRY_EVAL(ac_link) && test -s conftest; then 
  273.   AC_MSG_RESULT(yes)
  274. else
  275.   AC_MSG_ERROR([your system fails at linking a small KDE application!
  276. Check, if your compiler is installed correctly and if you have used the
  277. same compiler to compile Qt and kdelibs as you did use now])
  278. fi
  279.  
  280. if eval `KDEDIR= ./conftest 2>&5`; then
  281.   kde_result=done
  282. else
  283.   kde_result=problems
  284. fi
  285.  
  286. KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
  287. kde_have_all_paths=yes
  288.  
  289. if test "$kde_have_all_paths" = "yes"; then
  290. kde_cv_all_paths="kde_have_all_paths=\"yes\" \
  291.     kde_htmldir=\"$kde_htmldir\" \
  292.     kde_appsdir=\"$kde_appsdir\" \
  293.     kde_icondir=\"$kde_icondir\" \
  294.     kde_sounddir=\"$kde_sounddir\" \
  295.     kde_datadir=\"$kde_datadir\" \
  296.     kde_locale=\"$kde_locale\" \
  297.     kde_cgidir=\"$kde_cgidir\" \
  298.     kde_confdir=\"$kde_confdir\" \
  299.     kde_mimedir=\"$kde_mimedir\" \
  300.     kde_toolbardir=\"$kde_toolbardir\" \
  301.     kde_wallpaperdir=\"$kde_wallpaperdir\" \
  302.     kde_bindir=\"$kde_bindir\" \
  303.     kde_partsdir=\"$kde_partsdir\" \
  304.     kde_result=$kde_result"
  305. fi
  306.  
  307. fi
  308. ])
  309.  
  310. eval "$kde_cv_all_paths"
  311.  
  312. if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
  313.    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
  314.    test -z "$kde_datadir" || test -z "$kde_locale"  ||
  315.    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
  316.    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
  317.    test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
  318.    test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then
  319.   kde_have_all_paths=no
  320.   AC_MSG_ERROR([configure could not run a little KDE program to test the environment. 
  321. Since it had compiled and linked before, it must be a strange problem on your system.
  322. Look at config.log for details. If you are not able to fix this, look at
  323. http://www.kde.org/faq/installation.html or any www.kde.org mirror.
  324. (If you're using an egcs version on Linux, you may update binutils!)
  325. ])
  326. else
  327.   rm -f conftest*
  328.   AC_MSG_RESULT($kde_result)
  329. fi
  330.  
  331. bindir=$kde_bindir
  332.  
  333. ])
  334.  
  335. AC_DEFUN(AC_SUBST_KFSSTND,
  336. [
  337. AC_SUBST(kde_htmldir)
  338. AC_SUBST(kde_appsdir)
  339. AC_SUBST(kde_icondir)
  340. AC_SUBST(kde_sounddir)
  341. kde_minidir="$kde_icondir/mini"
  342. AC_SUBST(kde_minidir)
  343. AC_SUBST(kde_datadir)
  344. AC_SUBST(kde_locale)
  345. AC_SUBST(kde_cgidir)
  346. AC_SUBST(kde_confdir)
  347. AC_SUBST(kde_mimedir)
  348. AC_SUBST(kde_toolbardir)
  349. AC_SUBST(kde_wallpaperdir)
  350. AC_SUBST(kde_bindir)
  351. AC_SUBST(kde_partsdir)
  352. ])
  353.  
  354. AC_DEFUN(KDE_MISC_TESTS,
  355. [
  356.    AC_LANG_C
  357.    dnl Checks for libraries. 
  358.    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
  359.    AC_SUBST(LIBCOMPAT)
  360.    AC_CHECK_LIB(crypt, main, [LIBCRYPT="-lcrypt"]) dnl for BSD
  361.    AC_SUBST(LIBCRYPT)
  362.    AC_CHECK_KSIZE_T
  363.    AC_LANG_C
  364.    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
  365.    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
  366.       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
  367.         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
  368.    fi
  369.    AC_CHECK_FUNC(inet_ntoa)
  370.    if test $ac_cv_func_inet_ntoa = no; then
  371.      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
  372.    fi
  373.    AC_CHECK_FUNC(connect)
  374.    if test $ac_cv_func_connect = no; then
  375.       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
  376.         $X_EXTRA_LIBS)
  377.    fi
  378.  
  379.    AC_CHECK_FUNC(remove)
  380.    if test $ac_cv_func_remove = no; then
  381.       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
  382.    fi
  383.  
  384.    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
  385.    AC_CHECK_FUNC(shmat)
  386.    if test $ac_cv_func_shmat = no; then
  387.      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
  388.    fi
  389.  
  390.    LIBSOCKET="$X_EXTRA_LIBS"
  391.    AC_SUBST(LIBSOCKET)
  392.    AC_SUBST(X_EXTRA_LIBS)
  393.    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
  394.    AC_SUBST(LIBUCB)
  395.  
  396.    case $host in  dnl this *is* LynxOS specific
  397.    *-*-lynxos* )
  398.         AC_MSG_CHECKING([LynxOS header file wrappers])
  399.         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
  400.         AC_MSG_RESULT(disabled)
  401.         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
  402.          ;;
  403.     esac
  404.  
  405.    AC_REQUIRE([KDE_CHECK_LIBDL])
  406. ])
  407.  
  408. dnl ------------------------------------------------------------------------
  409. dnl Find the header files and libraries for X-Windows. Extended the 
  410. dnl macro AC_PATH_X
  411. dnl ------------------------------------------------------------------------
  412. dnl
  413. AC_DEFUN(K_PATH_X,
  414. [
  415. AC_REQUIRE([AC_PROG_CPP])
  416. AC_MSG_CHECKING(for X)
  417. AC_LANG_SAVE
  418. AC_LANG_C
  419. AC_CACHE_VAL(ac_cv_have_x,
  420. [# One or both of the vars are not set, and there is no cached value.
  421. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
  422.    kde_x_includes=NO
  423. else
  424.    kde_x_includes=$x_includes
  425. fi
  426. if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
  427.    kde_x_libraries=NO
  428. else
  429.    kde_x_libraries=$x_libraries
  430. fi
  431.  
  432. # below we use the standard autoconf calls
  433. ac_x_libraries=$kde_x_libraries
  434. ac_x_includes=$kde_x_includes
  435.  
  436. AC_PATH_X_DIRECT
  437. AC_PATH_X_XMKMF
  438. if test -z "$ac_x_includes"; then
  439. ac_x_includes="."
  440. fi
  441. if test -z "$ac_x_libraries"; then
  442. ac_x_libraries="/usr/lib"
  443. fi
  444. #from now on we use our own again 
  445.  
  446. # when the user already gave --x-includes, we ignore
  447. # what the standard autoconf macros told us.
  448. if test "$kde_x_includes" = NO; then
  449.   kde_x_includes=$ac_x_includes  
  450. fi
  451.  
  452. if test "$kde_x_includes" = NO; then
  453.   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
  454. fi
  455.  
  456. if test "$ac_x_libraries" = NO; then
  457.   AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
  458. fi
  459.  
  460. # Record where we found X for the cache.
  461. ac_cv_have_x="have_x=yes \
  462.          kde_x_includes=$kde_x_includes ac_x_libraries=$ac_x_libraries"
  463. ])dnl
  464. eval "$ac_cv_have_x"
  465.  
  466. if test "$have_x" != yes; then
  467.   AC_MSG_RESULT($have_x)
  468.   no_x=yes
  469. else
  470.   AC_MSG_RESULT([libraries $ac_x_libraries, headers $kde_x_includes])
  471. fi
  472.  
  473. if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
  474.   X_INCLUDES=""
  475.   x_includes="."; dnl better than nothing :-
  476.  else
  477.   x_includes=$kde_x_includes
  478.   X_INCLUDES="-I$x_includes"
  479. fi
  480.  
  481. if test -z "$ac_x_libraries" || test "x$ac_x_libraries" = xNONE; then
  482.   X_LDFLAGS=""
  483.   x_libraries="/usr/lib"; dnl better than nothing :-
  484.  else
  485.   x_libraries=$ac_x_libraries
  486.   X_LDFLAGS="-L$x_libraries"
  487. fi
  488. all_includes="$all_includes $X_INCLUDES"  
  489. all_libraries="$all_libraries $X_LDFLAGS"  
  490.  
  491. AC_SUBST(X_INCLUDES)
  492. AC_SUBST(X_LDFLAGS)
  493. AC_SUBST(x_libraries)
  494. AC_SUBST(x_includes)
  495.  
  496. LIB_X11='-lX11 $(LIBSOCKET)'
  497. AC_SUBST(LIB_X11)
  498.  
  499. AC_MSG_CHECKING(for libXext)
  500. AC_CACHE_VAL(kde_cv_have_libXext,
  501. [
  502. kde_ldflags_safe="$LDFLAGS"
  503. kde_libs_safe="$LIBS"
  504.  
  505. LDFLAGS="$X_LDFLAGS $USER_LDFLAGS"
  506. LIBS="-lXext -lX11 $LIBSOCKET"
  507.  
  508. AC_TRY_LINK([
  509. #include <stdio.h>
  510. ],
  511. [
  512. printf("hello Xext\n");
  513. ],
  514. kde_cv_have_libXext=yes,
  515. kde_cv_have_libXext=no
  516.    )
  517.  
  518. LDFLAGS=$kde_ldflags_safe
  519. LIBS=$kde_libs_safe
  520.  ])
  521.  
  522. AC_MSG_RESULT($kde_cv_have_libXext)
  523.  
  524. if test "kde_cv_have_libXext" = "no"; then
  525.   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
  526. can't find it itself, we stop here assuming that make wouldn't find
  527. them either.])
  528. fi
  529.  
  530. ])
  531.  
  532. AC_LANG_RESTORE
  533. ])
  534.  
  535. AC_DEFUN(KDE_PRINT_QT_PROGRAM,
  536. [
  537. AC_REQUIRE([KDE_USE_QT])
  538. cat > conftest.$ac_ext <<EOF
  539. #include "confdefs.h"
  540. #include <qglobal.h>
  541. #include <qapplication.h>
  542. #include <qobjcoll.h>
  543. EOF
  544. echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
  545. cat >> conftest.$ac_ext <<EOF
  546. #error 1
  547. #endif
  548.  
  549. int main() {
  550.     return 0;
  551. }
  552. EOF
  553. ])
  554.  
  555. AC_DEFUN(KDE_USE_QT,
  556. [
  557. if test -z "$1"; then
  558.   kde_qtver=2
  559. else
  560.   kde_qtver=$1
  561. fi
  562.  
  563. if test -z "$2"; then
  564.   if test $kde_qtver = 2; then
  565.     kde_qt_minversion=">= 2.0"
  566.    else
  567.     kde_qt_minversion=">= 1.42 and < 2.0"
  568.   fi
  569. else
  570.    kde_qt_minversion=$2
  571. fi
  572.  
  573. if test -z "$3"; then
  574.     if test $kde_qtver = 2; then
  575.     kde_qt_verstring="QT_VERSION >= 200"
  576.    else
  577.     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
  578.   fi
  579. else
  580.    kde_qt_verstring=$3
  581. fi
  582. ])
  583.  
  584. AC_DEFUN(KDE_CHECK_QT_DIRECT,
  585. [
  586. AC_REQUIRE([KDE_USE_QT])
  587. AC_MSG_CHECKING([if Qt compiles without flags])
  588. AC_CACHE_VAL(kde_cv_qt_direct,
  589. [
  590. AC_LANG_SAVE
  591. AC_LANG_CPLUSPLUS
  592. ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
  593. ac_LIBRARY_PATH="$LIBRARY_PATH"
  594. ac_cxxflags_safe="$CXXFLAGS"
  595. ac_ldflags_safe="$LDFLAGS"
  596. ac_libs_safe="$LIBS"
  597.  
  598. CXXFLAGS="$CXXFLAGS -I$qt_includes"
  599. LDFLAGS="$X_LDFLAGS"
  600. LIBS="-lqt -lXext -lX11 $LIBSOCKET"
  601. LD_LIBRARY_PATH=
  602. export LD_LIBRARY_PATH
  603. LIBRARY_PATH=
  604. export LIBRARY_PATH
  605.  
  606. KDE_PRINT_QT_PROGRAM
  607.  
  608. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  609.   kde_cv_qt_direct="yes"
  610. else
  611.   kde_cv_qt_direct="no"
  612.   echo "configure: failed program was:" >&AC_FD_CC
  613.   cat conftest.$ac_ext >&AC_FD_CC
  614. fi
  615. rm -f conftest*
  616. CXXFLAGS="$ac_cxxflags_safe"
  617. LDFLAGS="$ac_ldflags_safe"
  618. LIBS="$ac_libs_safe"
  619.  
  620. LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
  621. export LD_LIBRARY_PATH
  622. LIBRARY_PATH="$ac_LIBRARY_PATH"
  623. export LIBRARY_PATH
  624. AC_LANG_RESTORE
  625. ])
  626.  
  627. if test "$kde_cv_qt_direct" = "yes"; then
  628.   AC_MSG_RESULT(yes)
  629.   $1
  630. else
  631.   AC_MSG_RESULT(no)
  632.   $2
  633. fi
  634. ])
  635.  
  636. dnl ------------------------------------------------------------------------
  637. dnl Try to find the Qt headers and libraries.
  638. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
  639. dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
  640. dnl ------------------------------------------------------------------------
  641. dnl
  642. AC_DEFUN(AC_PATH_QT_1_3,
  643. [
  644. AC_REQUIRE([K_PATH_X])
  645. AC_REQUIRE([KDE_USE_QT])
  646. LIBQT="-lqt"
  647. if test $kde_qtver = 2; then
  648.   
  649.   AC_REQUIRE([AC_FIND_PNG])
  650.   LIBQT="$LIBQT $LIBPNG"
  651. fi
  652. AC_MSG_CHECKING([for Qt])
  653.  
  654. LIBQT="$LIBQT -lXext -lX11 $LIBSOCKET"
  655. ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
  656. qt_libraries=""
  657. qt_includes=""
  658. AC_ARG_WITH(qt-dir,
  659.     [  --with-qt-dir=DIR       where the root of Qt is installed ],
  660.     [  ac_qt_includes="$withval"/include
  661.        ac_qt_libraries="$withval"/lib
  662.        ac_qt_bindir="$withval"/bin
  663.     ])
  664.  
  665. AC_ARG_WITH(qt-includes,
  666.     [  --with-qt-includes=DIR  where the Qt includes are. ],
  667.     [  
  668.        ac_qt_includes="$withval"
  669.     ])
  670.     
  671. kde_qt_libs_given=no
  672.  
  673. AC_ARG_WITH(qt-libraries,
  674.     [  --with-qt-libraries=DIR where the Qt library is installed.],
  675.     [  ac_qt_libraries="$withval"
  676.        kde_qt_libs_given=yes
  677.     ])
  678.  
  679. AC_CACHE_VAL(ac_cv_have_qt,
  680. [#try to guess Qt locations
  681.  
  682. qt_incdirs="$QTINC /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes"
  683. test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
  684. qt_incdirs="$ac_qt_includes $qt_incdirs"
  685. AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir)
  686. ac_qt_includes="$qt_incdir"
  687.  
  688. qt_libdirs="$QTLIB /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt $x_libraries"
  689. test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
  690. if test ! "$ac_qt_libraries" = "NO"; then
  691.   qt_libdirs="$ac_qt_libraries $qt_libdirs"
  692. fi
  693.  
  694. test=NONE
  695. qt_libdir=NONE
  696. for dir in $qt_libdirs; do
  697.   try="ls -1 $dir/libqt*"
  698.   if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  699. done
  700.  
  701. ac_qt_libraries="$qt_libdir"
  702.  
  703. AC_LANG_SAVE
  704. AC_LANG_CPLUSPLUS
  705.  
  706. ac_cxxflags_safe="$CXXFLAGS"
  707. ac_ldflags_safe="$LDFLAGS"
  708. ac_libs_safe="$LIBS"
  709.  
  710. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  711. LDFLAGS="-L$qt_libdir $all_libraries"
  712. LIBS="$LIBS $LIBQT"
  713.  
  714. KDE_PRINT_QT_PROGRAM
  715.  
  716. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  717.   rm -f conftest*
  718. else
  719.   echo "configure: failed program was:" >&AC_FD_CC
  720.   cat conftest.$ac_ext >&AC_FD_CC
  721.   ac_qt_libraries="NO"
  722. fi
  723. rm -f conftest*
  724. CXXFLAGS="$ac_cxxflags_safe"
  725. LDFLAGS="$ac_ldflags_safe"
  726. LIBS="$ac_libs_safe"
  727.  
  728. AC_LANG_RESTORE
  729. if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
  730.   ac_cv_have_qt="have_qt=no"
  731.   ac_qt_notfound=""
  732.   if test "$ac_qt_includes" = NO; then
  733.     if test "$ac_qt_libraries" = NO; then
  734.       ac_qt_notfound="(headers and libraries)";
  735.     else
  736.       ac_qt_notfound="(headers)";
  737.     fi
  738.   else
  739.     ac_qt_notfound="(libraries)";
  740.   fi
  741.  
  742.   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! ]);
  743. else
  744.   have_qt="yes"
  745. fi
  746. ])
  747.  
  748. eval "$ac_cv_have_qt"
  749.  
  750. if test "$have_qt" != yes; then
  751.   AC_MSG_RESULT([$have_qt]);
  752. else
  753.   ac_cv_have_qt="have_qt=yes \
  754.     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
  755.   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
  756.   
  757.   qt_libraries="$ac_qt_libraries"
  758.   qt_includes="$ac_qt_includes"
  759. fi
  760.  
  761. if test ! "$kde_qt_libs_given" = "yes"; then
  762. KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
  763. fi
  764.  
  765. AC_SUBST(qt_libraries)
  766. AC_SUBST(qt_includes)
  767.  
  768. if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
  769.  QT_INCLUDES="";
  770. else
  771.  QT_INCLUDES="-I$qt_includes"
  772.  all_includes="$QT_INCLUDES $all_includes"
  773. fi
  774.  
  775. if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
  776.  QT_LDFLAGS=""
  777. else
  778.  QT_LDFLAGS="-L$qt_libraries"
  779.  all_libraries="$QT_LDFLAGS $all_libraries"
  780. fi
  781.  
  782. AC_SUBST(QT_INCLUDES)
  783. AC_SUBST(QT_LDFLAGS)
  784. AC_PATH_QT_MOC
  785.  
  786. LIB_QT='-lqt $(LIBPNG) $(LIB_X11)'
  787. AC_SUBST(LIB_QT)
  788.  
  789. ])
  790.  
  791. AC_DEFUN(AC_PATH_QT,
  792. [
  793. AC_PATH_QT_1_3
  794. ])
  795.  
  796. dnl ------------------------------------------------------------------------
  797. dnl Now, the same with KDE
  798. dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
  799. dnl and $(kde_includes) will be the kdehdrlocation (if needed)
  800. dnl ------------------------------------------------------------------------
  801. dnl
  802. AC_DEFUN(AC_BASE_PATH_KDE,
  803. [
  804. AC_PREREQ([2.13])
  805. AC_REQUIRE([KDE_MISC_TESTS])
  806. AC_REQUIRE([AC_PATH_QT])dnl
  807. AC_MSG_CHECKING([for KDE])
  808.  
  809. if test "${prefix}" != NONE; then
  810.   kde_includes=${prefix}/include
  811.   ac_kde_includes=$prefix/include
  812.  
  813.   if test "${exec_prefix}" != NONE; then
  814.     kde_libraries=${exec_prefix}/lib
  815.     ac_kde_libraries=$exec_prefix/lib
  816.   else
  817.     kde_libraries=${prefix}/lib
  818.     ac_kde_libraries=$prefix/lib
  819.   fi
  820. else
  821.   ac_kde_includes=
  822.   ac_kde_libraries=
  823.   kde_libraries=""
  824.   kde_includes=""
  825. fi
  826.  
  827. AC_CACHE_VAL(ac_cv_have_kde,
  828. [#try to guess kde locations
  829.  
  830. if test -z "$1"; then
  831.  
  832. kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde/include $x_includes $qt_includes"
  833. test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs"
  834. kde_incdirs="$ac_kde_includes $kde_incdirs"
  835. AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir)
  836. ac_kde_includes="$kde_incdir"
  837.  
  838. if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then
  839.   AC_MSG_ERROR([
  840. in the prefix, you've chosen, are no KDE headers installed. This will fail.
  841. So, check this please and use another prefix!])
  842. fi
  843.  
  844. kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /opt/kde/lib /usr/X11R6/kde/lib"
  845. test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
  846. kde_libdirs="$ac_kde_libraries $kde_libdirs"
  847. AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir)
  848. ac_kde_libraries="$kde_libdir"
  849.  
  850. if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then
  851. AC_MSG_ERROR([
  852. in the prefix, you've chosen, are no KDE libraries installed. This will fail.
  853. So, check this please and use another prefix!])
  854. fi
  855. ac_kde_libraries="$kde_libdir"
  856.  
  857. if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
  858.   ac_cv_have_kde="have_kde=no"
  859. else
  860.   ac_cv_have_kde="have_kde=yes \
  861.     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  862. fi
  863.  
  864. else dnl test -z $1 
  865.   
  866.   ac_cv_have_kde="have_kde=no"
  867.  
  868. fi
  869. ])dnl
  870.  
  871. eval "$ac_cv_have_kde"
  872.  
  873. if test "$have_kde" != "yes"; then
  874.  if test "${prefix}" = NONE; then
  875.   ac_kde_prefix="$ac_default_prefix"
  876.  else
  877.   ac_kde_prefix="$prefix"
  878.  fi
  879.  if test "$exec_prefix" = NONE; then
  880.   ac_kde_exec_prefix="$ac_kde_prefix"
  881.   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
  882.  else
  883.   ac_kde_exec_prefix="$exec_prefix"
  884.   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
  885.  fi
  886.  
  887.  kde_libraries="${ac_kde_exec_prefix}/lib"
  888.  kde_includes=${ac_kde_prefix}/include
  889.  
  890. else
  891.   ac_cv_have_kde="have_kde=yes \
  892.     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  893.   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
  894.   
  895.   kde_libraries="$ac_kde_libraries"
  896.   kde_includes="$ac_kde_includes"
  897. fi
  898. AC_SUBST(kde_libraries)
  899. AC_SUBST(kde_includes)
  900.  
  901. if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
  902.  KDE_INCLUDES=""
  903. else
  904.  KDE_INCLUDES="-I$kde_includes"
  905.  all_includes="$KDE_INCLUDES $all_includes"
  906. fi
  907.  
  908. if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then
  909.  KDE_LDFLAGS=""
  910. else
  911.  KDE_LDFLAGS="-L$kde_libraries"
  912.  all_libraries="$KDE_LDFLAGS $all_libraries"
  913. fi
  914.  
  915. AC_SUBST(KDE_LDFLAGS)
  916. AC_SUBST(KDE_INCLUDES)
  917.  
  918. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  919.  
  920. AC_SUBST(all_includes)
  921. AC_SUBST(all_libraries)
  922.  
  923. ])
  924.  
  925. AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
  926. [
  927. AC_MSG_CHECKING(for extra includes)
  928. AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
  929.                           adds non standard include paths], 
  930.   kde_use_extra_includes="$withval",
  931.   kde_use_extra_includes=NONE
  932. )
  933. if test -n "$kde_use_extra_includes" && \
  934.    test "$kde_use_extra_includes" != "NONE"; then
  935.  
  936.    ac_save_ifs=$IFS
  937.    IFS=':'
  938.    for dir in $kde_use_extra_includes; do
  939.      all_includes="$all_includes -I$dir"
  940.      USER_INCLUDES="$USER_INCLUDES -I$dir"
  941.    done
  942.    IFS=$ac_save_ifs
  943.    kde_use_extra_includes="added"
  944. else
  945.    kde_use_extra_includes="no"
  946. fi
  947. AC_SUBST(USER_INCLUDES)
  948.  
  949. AC_MSG_RESULT($kde_use_extra_includes)
  950.  
  951. AC_MSG_CHECKING(for extra libs)
  952. AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths], 
  953.   kde_use_extra_libs=$withval,
  954.   kde_use_extra_libs=NONE
  955. )
  956. if test -n "$kde_use_extra_libs" && \
  957.    test "$kde_use_extra_libs" != "NONE"; then
  958.  
  959.    ac_save_ifs=$IFS
  960.    IFS=':'
  961.    for dir in $kde_use_extra_libs; do
  962.      all_libraries="$all_libraries -L$dir"
  963.      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir"
  964.      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
  965.    done
  966.    IFS=$ac_save_ifs
  967.    kde_use_extra_libs="added"
  968. else
  969.    kde_use_extra_libs="no"
  970. fi
  971.  
  972. AC_SUBST(USER_LDFLAGS)
  973.  
  974. AC_MSG_RESULT($kde_use_extra_libs)
  975.  
  976. ])
  977.  
  978. AC_DEFUN(KDE_CHECK_KIMGIO,
  979. [
  980.    AC_REQUIRE([AC_BASE_PATH_KDE])
  981.    AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  982.    AC_REQUIRE([AC_FIND_TIFF])
  983.    AC_REQUIRE([AC_FIND_JPEG]) 
  984.    AC_REQUIRE([AC_FIND_PNG]) 
  985.    AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
  986.    
  987.    if test "$1" = "existance"; then
  988.      AC_LANG_SAVE
  989.      AC_LANG_CPLUSPLUS
  990.      kde_save_LIBS="$LIBS"
  991.      LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
  992.      AC_CHECK_LIB(kimgio, kimgioRegister, [
  993.       LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
  994.       LIBS="$kde_save_LIBS"
  995.       AC_LANG_RESTORE   
  996.    else
  997.       LIBKIMGIO_EXISTS=yes
  998.    fi
  999.  
  1000.    if test "$LIBKIMGIO_EXISTS" = "yes"; then
  1001.      LIB_KIMGIO='-lkimgio'
  1002.    else
  1003.      LIB_KIMGIO=''
  1004.    fi
  1005.    AC_SUBST(LIB_KIMGIO)
  1006.    
  1007.    LIB_KHTML='-lkhtml'
  1008.    AC_SUBST(LIB_KHTML)
  1009. ])
  1010.  
  1011. AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
  1012. [
  1013.    AC_REQUIRE([KDE_MISC_TESTS])
  1014.    AC_REQUIRE([KDE_CHECK_LIBDL])
  1015.    AC_REQUIRE([K_PATH_X])
  1016.  
  1017.    LIB_KDECORE='-lkdecore'
  1018.    AC_SUBST(LIB_KDECORE)
  1019.    LIB_KDEUI='-lkdeui'
  1020.    AC_SUBST(LIB_KDEUI)
  1021.    LIB_KFORMULA='-lformula'
  1022.    AC_SUBST(LIB_KFORMULA)
  1023.    LIB_KFM='-lkfm'
  1024.    AC_SUBST(LIB_KFM)
  1025.    LIB_KDEUTIL='-lkdeutil'
  1026.    AC_SUBST(LIB_KDEUTIL)
  1027.    LIB_KIO='-lkio'
  1028.    AC_SUBST(LIB_KIO)
  1029.    LIB_SMB='-lsmb'
  1030.    AC_SUBST(LIB_SMB)
  1031.    LIB_KFILE='-lkfile'
  1032.    AC_SUBST(LIB_KFILE)
  1033.    LIB_KAB='-lkab'
  1034.    AC_SUBST(LIB_KAB)
  1035.    LIB_MEDIATOOL='-lmediatool'
  1036.    AC_SUBST(LIB_MEDIATOOL) 
  1037. ])
  1038.  
  1039. AC_DEFUN(AC_PATH_KDE,
  1040. [
  1041.   AC_BASE_PATH_KDE
  1042.   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
  1043.   [
  1044.   if test "$enableval" = "no"; 
  1045.     then ac_use_path_checking="default"
  1046.     else ac_use_path_checking=""
  1047.   fi
  1048.   ], [ac_use_path_checking=""]
  1049.   )
  1050.  
  1051.   AC_CREATE_KFSSTND($ac_use_path_checking)
  1052.  
  1053.   AC_SUBST_KFSSTND
  1054.   KDE_CREATE_LIBS_ALIASES
  1055. ])
  1056.  
  1057. dnl slightly changed version of AC_CHECK_FUNC(setenv)
  1058. AC_DEFUN(AC_CHECK_SETENV,
  1059. [AC_MSG_CHECKING([for setenv])
  1060. AC_CACHE_VAL(ac_cv_func_setenv,
  1061. [AC_LANG_C
  1062. AC_TRY_LINK(
  1063. dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
  1064. dnl which includes <sys/select.h> which contains a prototype for
  1065. dnl select.  Similarly for bzero.
  1066. [#include <assert.h>
  1067. ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
  1068. extern "C"
  1069. #endif
  1070. ])dnl
  1071. [/* We use char because int might match the return type of a gcc2
  1072.     builtin and then its argument prototype would still apply.  */
  1073. #include <stdlib.h>
  1074. ], [
  1075. /* The GNU C library defines this for functions which it implements
  1076.     to always fail with ENOSYS.  Some functions are actually named
  1077.     something starting with __ and the normal name is an alias.  */
  1078. #if defined (__stub_$1) || defined (__stub___$1)
  1079. choke me
  1080. #else
  1081. setenv("TEST", "alle", 1);
  1082. #endif
  1083. ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
  1084.  
  1085. if test "$ac_cv_func_setenv" = "yes"; then
  1086.   AC_MSG_RESULT(yes)
  1087.   AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV)
  1088. else
  1089.   AC_MSG_RESULT(no)
  1090. fi
  1091. ])
  1092.  
  1093. AC_DEFUN(AC_CHECK_GETDOMAINNAME,
  1094. [
  1095. AC_LANG_CPLUSPLUS
  1096. save_CXXFLAGS="$CXXFLAGS"
  1097. if test "$GCC" = "yes"; then
  1098. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  1099. fi
  1100. AC_MSG_CHECKING(for getdomainname)
  1101. AC_CACHE_VAL(ac_cv_func_getdomainname,
  1102. [
  1103. AC_TRY_COMPILE([
  1104. #include <stdlib.h>
  1105. #include <unistd.h>
  1106. ],
  1107. [
  1108. char buffer[200];
  1109. getdomainname(buffer, 200);
  1110. ],
  1111. ac_cv_func_getdomainname=yes,
  1112. ac_cv_func_getdomainname=no)
  1113. ])
  1114. AC_MSG_RESULT($ac_cv_func_getdomainname)
  1115. if eval "test \"`echo `$ac_cv_func_getdomainname\" = yes"; then
  1116.   AC_DEFINE(HAVE_GETDOMAINNAME)
  1117. fi
  1118. CXXFLAGS="$save_CXXFLAGS"
  1119. ])
  1120.  
  1121. AC_DEFUN(AC_CHECK_GETHOSTNAME,
  1122. [
  1123. AC_LANG_CPLUSPLUS
  1124. save_CXXFLAGS="$CXXFLAGS"
  1125. if test "$GCC" = "yes"; then
  1126. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  1127. fi
  1128.  
  1129. AC_MSG_CHECKING([for gethostname])
  1130. AC_CACHE_VAL(ac_cv_func_gethostname,
  1131. [
  1132. AC_TRY_COMPILE([
  1133. #include <stdlib.h>
  1134. #include <unistd.h>
  1135. ],
  1136. [
  1137. char buffer[200];
  1138. gethostname(buffer, 200);
  1139. ],
  1140. ac_cv_func_gethostname=yes,
  1141. ac_cv_func_gethostname=no)
  1142. ])
  1143. AC_MSG_RESULT($ac_cv_func_gethostname)
  1144. if eval "test \"`echo `$ac_cv_func_gethostname\" = yes"; then
  1145.   AC_DEFINE(HAVE_GETHOSTNAME)
  1146. fi
  1147. CXXFLAGS="$save_CXXFLAGS"
  1148. ])
  1149.  
  1150. AC_DEFUN(AC_CHECK_USLEEP,
  1151. [
  1152. AC_LANG_CPLUSPLUS
  1153.  
  1154. AC_MSG_CHECKING([for usleep])
  1155. AC_CACHE_VAL(ac_cv_func_usleep,
  1156. [
  1157. ac_libs_safe="$LIBS"
  1158. LIBS="$LIBS $LIBUCB"
  1159. AC_TRY_LINK([
  1160. #include <stdlib.h>
  1161. #include <unistd.h>
  1162. ],
  1163. [
  1164. usleep(200);
  1165. ],
  1166. ac_cv_func_usleep=yes,
  1167. ac_cv_func_usleep=no)
  1168. ])
  1169. AC_MSG_RESULT($ac_cv_func_usleep)
  1170. if eval "test \"`echo `$ac_cv_func_usleep\" = yes"; then
  1171.   AC_DEFINE(HAVE_USLEEP)
  1172. fi
  1173. LIBS="$ac_libs_safe"
  1174. ])
  1175.  
  1176. AC_DEFUN(AC_CHECK_RANDOM,
  1177. [
  1178. AC_LANG_CPLUSPLUS
  1179.  
  1180. AC_MSG_CHECKING([for random])
  1181. AC_CACHE_VAL(ac_cv_func_random,
  1182. [
  1183. ac_libs_safe="$LIBS"
  1184. LIBS="$LIBS $LIBUCB"
  1185. AC_TRY_LINK([
  1186. #include <stdlib.h>
  1187. ],
  1188. [
  1189. random();
  1190. ],
  1191. ac_cv_func_random=yes,
  1192. ac_cv_func_random=no)
  1193. ])
  1194. AC_MSG_RESULT($ac_cv_func_random)
  1195. if eval "test \"`echo `$ac_cv_func_random\" = yes"; then
  1196.   AC_DEFINE(HAVE_RANDOM)
  1197. fi
  1198. LIBS="$ac_libs_safe"
  1199. ])
  1200.  
  1201. AC_DEFUN(AC_FIND_GIF,
  1202.    [AC_MSG_CHECKING([for giflib])
  1203. AC_CACHE_VAL(ac_cv_lib_gif,
  1204. [ac_save_LIBS="$LIBS"
  1205. LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
  1206. AC_TRY_LINK(dnl
  1207. [
  1208. #ifdef __cplusplus
  1209. extern "C" {
  1210. #endif
  1211. int GifLastError(void);
  1212. #ifdef __cplusplus
  1213. }
  1214. #endif
  1215. /* We use char because int might match the return type of a gcc2
  1216.     builtin and then its argument prototype would still apply.  */
  1217. ],
  1218.             [return GifLastError();],
  1219.             eval "ac_cv_lib_gif=yes",
  1220.             eval "ac_cv_lib_gif=no")
  1221. LIBS="$ac_save_LIBS"
  1222. ])dnl
  1223. if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
  1224.   AC_MSG_RESULT(yes)
  1225.   AC_DEFINE_UNQUOTED(HAVE_LIBGIF)
  1226. else
  1227.   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
  1228. fi
  1229. ])
  1230.  
  1231. AC_DEFUN(KDE_FIND_JPEG_HELPER,
  1232. [
  1233. AC_MSG_CHECKING([for libjpeg$2])
  1234. AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
  1235. [
  1236. AC_LANG_C
  1237. ac_save_LIBS="$LIBS"
  1238. LIBS="$all_libraries -ljpeg$2 -lm"
  1239. AC_TRY_LINK(
  1240. [/* Override any gcc2 internal prototype to avoid an error.  */
  1241. struct jpeg_decompress_struct;
  1242. typedef struct jpeg_decompress_struct * j_decompress_ptr;
  1243. typedef int size_t;
  1244. #ifdef __cplusplus
  1245. extern "C" {
  1246. #endif
  1247.     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
  1248.                                     int version, size_t structsize);
  1249. #ifdef __cplusplus
  1250. }
  1251. #endif
  1252. /* We use char because int might match the return type of a gcc2
  1253.     builtin and then its argument prototype would still apply.  */
  1254. ],
  1255.             [jpeg_CreateDecompress(0L, 0, 0);],
  1256.             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
  1257.             eval "ac_cv_lib_jpeg_$1=no")
  1258. LIBS="$ac_save_LIBS"
  1259. ])
  1260.  
  1261. if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
  1262.   LIBJPEG="$ac_cv_lib_jpeg_$1"
  1263.   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
  1264. else
  1265.   AC_MSG_RESULT(no)
  1266.   $3
  1267. fi
  1268.  
  1269. ])
  1270.  
  1271. AC_DEFUN(AC_FIND_JPEG,
  1272. [
  1273. KDE_FIND_JPEG_HELPER(6b, 6b,
  1274.    KDE_FIND_JPEG_HELPER(normal, [],
  1275.     [
  1276. dnl what to do, if the normal way fails:
  1277.     if test -f "$kde_libraries/libjpeg.so"; then
  1278.        test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
  1279.        ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
  1280.     else if test -f "$kde_libraries/libjpeg.sl"; then
  1281.        test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
  1282.        ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"    
  1283.     else if test -f "$kde_libraries/libjpeg.a"; then
  1284.        test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
  1285.        ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
  1286.         else
  1287.       AC_MSG_ERROR([
  1288. You need jpeglib6b. Please install the kdesupport package.
  1289. If you have already installed kdesupport you may have an
  1290. old libjpeg somewhere. 
  1291. In this case copy $KDEDIR/lib/libjpeg* to /usr/lib.
  1292. ])
  1293.     fi
  1294.       fi
  1295.    fi
  1296.  
  1297.    LIBJPEG=$ac_cv_lib_jpeg
  1298. ]))
  1299.  
  1300. AC_SUBST(LIBJPEG)
  1301. AC_DEFINE_UNQUOTED(HAVE_LIBJPEG)
  1302.  
  1303. ])
  1304.  
  1305. AC_DEFUN(AC_FIND_ZLIB,
  1306. [
  1307. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1308. AC_MSG_CHECKING([for libz])
  1309. AC_CACHE_VAL(ac_cv_lib_z,
  1310. [
  1311. AC_LANG_C
  1312. kde_save_LIBS="$LIBS"
  1313. LIBS="$all_libraries -lz $LIBSOCKET"
  1314. kde_save_CFLAGS="$CFLAGS"
  1315. CFLAGS="$CFLAGS $all_includes"
  1316. AC_TRY_LINK(dnl
  1317. [
  1318. #include<zlib.h>
  1319. ],
  1320.             [return (zlibVersion() == ZLIB_VERSION); ],
  1321.             eval "ac_cv_lib_z='-lz'",
  1322.             eval "ac_cv_lib_z=no")
  1323. LIBS="$kde_save_LIBS"
  1324. CFLAGS="$kde_save_CFLAGS"
  1325. ])dnl
  1326. if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
  1327.   AC_DEFINE_UNQUOTED(HAVE_LIBZ)
  1328.   LIBZ="$ac_cv_lib_z"
  1329.   AC_SUBST(LIBZ)
  1330.   AC_MSG_RESULT($ac_cv_lib_z)
  1331. else
  1332.   AC_MSG_RESULT(no)
  1333.   LIBZ=""
  1334.   AC_SUBST(LIBZ)
  1335. fi
  1336. ])
  1337.  
  1338. AC_DEFUN(KDE_TRY_TIFFLIB,
  1339. [
  1340. AC_MSG_CHECKING([for libtiff $1])
  1341.  
  1342. AC_CACHE_VAL(kde_cv_libtiff_$1, 
  1343. [
  1344. AC_LANG_C
  1345. kde_save_LIBS="$LIBS"
  1346. LIBS="$all_libraries -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
  1347. kde_save_CFLAGS="$CFLAGS"
  1348. CFLAGS="$CFLAGS $all_includes"
  1349.  
  1350. AC_TRY_LINK(dnl
  1351. [
  1352. #include<tiffio.h>
  1353. ],
  1354.     [return (TIFFOpen( "", "r") == 0); ],
  1355. [
  1356.     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
  1357. ], [
  1358.     kde_cv_libtiff_$1=no
  1359. ])
  1360.  
  1361. LIBS="$kde_save_LIBS"
  1362. CFLAGS="$kde_save_CFLAGS"
  1363.  
  1364. ])
  1365.  
  1366. if test "$kde_cv_libtiff_$1" = "no"; then
  1367.     AC_MSG_RESULT(no)
  1368.     LIBTIFF=""
  1369.     $3
  1370. else
  1371.     LIBTIFF="$kde_cv_libtiff_$1"
  1372.     AC_MSG_RESULT(yes)
  1373.     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF)
  1374.     $2
  1375. fi
  1376.  
  1377. ])
  1378.  
  1379. AC_DEFUN(AC_FIND_TIFF,
  1380. [
  1381. AC_REQUIRE([K_PATH_X])
  1382. AC_REQUIRE([AC_FIND_ZLIB])
  1383. AC_REQUIRE([AC_FIND_JPEG])
  1384. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1385.  
  1386. KDE_TRY_TIFFLIB(tiff, [],
  1387.    KDE_TRY_TIFFLIB(tiff34))
  1388.  
  1389. AC_SUBST(LIBTIFF)
  1390. ])
  1391.  
  1392.  
  1393. AC_DEFUN(AC_FIND_PNG,
  1394. [
  1395. AC_REQUIRE([AC_FIND_ZLIB])
  1396. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1397. AC_MSG_CHECKING([for libpng])
  1398. AC_CACHE_VAL(ac_cv_lib_png,
  1399. [
  1400. kde_save_LIBS="$LIBS"
  1401. LIBS="$LIBS $all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
  1402. kde_save_CFLAGS="$CFLAGS"
  1403. CFLAGS="$CFLAGS $all_includes"
  1404. AC_LANG_C
  1405. AC_TRY_LINK(dnl
  1406.     [
  1407.     #include<png.h>
  1408.     ],
  1409.     [
  1410.     png_structp png_ptr = png_create_read_struct(  /* image ptr */
  1411.         PNG_LIBPNG_VER_STRING, 0, 0, 0 );
  1412.     return( png_ptr != 0 ); 
  1413.     ],
  1414.     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
  1415.     eval "ac_cv_lib_png=no"
  1416. )
  1417. LIBS="$kde_save_LIBS"
  1418. CFLAGS="$kde_save_CFLAGS"
  1419. ])dnl
  1420. if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
  1421.   AC_DEFINE_UNQUOTED(HAVE_LIBPNG)
  1422.   LIBPNG="$ac_cv_lib_png"
  1423.   AC_SUBST(LIBPNG)
  1424.   AC_MSG_RESULT($ac_cv_lib_png)
  1425. else
  1426.   AC_MSG_RESULT(no)
  1427.   LIBPNG=""
  1428.   AC_SUBST(LIBPNG)
  1429. fi
  1430. ])
  1431.  
  1432. AC_DEFUN(AC_CHECK_BOOL,
  1433. [
  1434.     AC_MSG_CHECKING([for bool])
  1435.         AC_CACHE_VAL(ac_cv_have_bool,
  1436.         [
  1437.         AC_LANG_CPLUSPLUS
  1438.               AC_TRY_COMPILE([],
  1439.                  [bool aBool = true;],
  1440.                  [ac_cv_have_bool="yes"],
  1441.                  [ac_cv_have_bool="no"])
  1442.         ]) dnl end AC_CHECK_VAL
  1443.         AC_MSG_RESULT($ac_cv_have_bool)
  1444.         if test "$ac_cv_have_bool" = "yes"; then
  1445.             AC_DEFINE(HAVE_BOOL) 
  1446.         fi 
  1447. ])
  1448.  
  1449. AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
  1450. [
  1451. AC_MSG_CHECKING(if you need GNU extensions)
  1452. AC_CACHE_VAL(ac_cv_gnu_extensions,
  1453. [
  1454. cat > conftest.c << EOF
  1455. #include <features.h>
  1456.  
  1457. #ifdef __GNU_LIBRARY__
  1458. yes
  1459. #endif
  1460. EOF
  1461.  
  1462. if (eval "$ac_cpp conftest.c") 2>&5 |
  1463.   egrep "yes" >/dev/null 2>&1; then
  1464.   rm -rf conftest*
  1465.   ac_cv_gnu_extensions=yes
  1466. else
  1467.   ac_cv_gnu_extensions=no
  1468. fi
  1469. ])
  1470.  
  1471. AC_MSG_RESULT($ac_cv_gnu_extensions)
  1472. if test "$ac_cv_gnu_extensions" = "yes"; then
  1473.   AC_DEFINE_UNQUOTED(_GNU_SOURCE)
  1474. fi
  1475. ])
  1476.  
  1477. AC_DEFUN(AC_CHECK_COMPILERS,
  1478. [
  1479.   dnl this is somehow a fat lie, but prevents other macros from double checking
  1480.   AC_PROVIDE([AC_PROG_CC])
  1481.   AC_PROVIDE([AC_PROG_CPP])
  1482.   AC_ARG_ENABLE(debug,[  --enable-debug          creates debugging code [default=no]],
  1483.   [ 
  1484.    if test $enableval = "no"; dnl 
  1485.      then 
  1486.        kde_use_debug_code="no"
  1487.        kde_use_debug_define=yes
  1488.      else 
  1489.        kde_use_debug_code="yes"
  1490.        kde_use_debug_define=no
  1491.    fi
  1492.   ], [kde_use_debug_code="no"
  1493.       kde_use_debug_define=no
  1494.     ])
  1495.  
  1496.   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
  1497.    [ 
  1498.     if test $enableval = "no"; then 
  1499.          kde_use_strict_options="no"
  1500.        else 
  1501.          kde_use_strict_options="yes"
  1502.     fi
  1503.    ], [kde_use_strict_options="no"])
  1504.  
  1505. dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
  1506.   AC_MSG_CHECKING(for a C-Compiler)
  1507.   dnl if there is one, print out. if not, don't matter
  1508.   AC_MSG_RESULT($CC) 
  1509.  
  1510.   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
  1511.   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
  1512.   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
  1513.   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
  1514.  
  1515.   AC_PROG_CC_WORKS
  1516.   AC_PROG_CC_GNU
  1517.  
  1518.   if test $ac_cv_prog_gcc = yes; then
  1519.     GCC=yes
  1520.   else
  1521.     GCC=
  1522.   fi
  1523.  
  1524.   if test -z "$CFLAGS"; then
  1525.     if test "$kde_use_debug_code" = "yes"; then
  1526.       AC_PROG_CC_G
  1527.       if test $ac_cv_prog_cc_g = yes; then
  1528.         CFLAGS="-g"
  1529.       fi
  1530.     else
  1531.       if test "$GCC" = "yes"; then
  1532.         CFLAGS="-O2"
  1533.       else
  1534.         CFLAGS=""
  1535.       fi
  1536.       if test "$kde_use_debug_define" = "yes"; then
  1537.          CFLAGS="$CFLAGS -DNDEBUG"
  1538.       fi
  1539.     fi
  1540.  
  1541.     if test "$GCC" = "yes"; then
  1542.      CFLAGS="$CFLAGS -Wall"
  1543.  
  1544.      if test "$kde_use_strict_options" = "yes"; then
  1545.     CFLAGS="$CFLAGS -W -ansi -pedantic"     
  1546.      fi
  1547.     fi
  1548.  
  1549.   fi
  1550.  
  1551.   case "$host" in 
  1552.   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
  1553.   esac
  1554.  
  1555.   if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
  1556.      LDFLAGS="-s"
  1557.   fi
  1558.  
  1559.  
  1560. dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
  1561. dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
  1562.  
  1563.   AC_MSG_CHECKING(how to run the C preprocessor)
  1564.   # On Suns, sometimes $CPP names a directory.
  1565.   if test -n "$CPP" && test -d "$CPP"; then
  1566.     CPP=
  1567.   fi
  1568.   if test -z "$CPP"; then
  1569.   AC_CACHE_VAL(ac_cv_prog_CPP,
  1570.   [  # This must be in double quotes, not single quotes, because CPP may get
  1571.     # substituted into the Makefile and "${CC-cc}" will confuse make.
  1572.     CPP="${CC-cc} -E"
  1573.     # On the NeXT, cc -E runs the code through the compiler's parser,
  1574.     # not just through cpp.
  1575.     dnl Use a header file that comes with gcc, so configuring glibc    
  1576.     dnl with a fresh cross-compiler works.
  1577.     AC_TRY_CPP([#include <assert.h>
  1578.     Syntax Error], ,
  1579.     CPP="${CC-cc} -E -traditional-cpp"
  1580.     AC_TRY_CPP([#include <assert.h>
  1581.     Syntax Error], , CPP=/lib/cpp))
  1582.     ac_cv_prog_CPP="$CPP"])dnl
  1583.     CPP="$ac_cv_prog_CPP"
  1584.   else
  1585.     ac_cv_prog_CPP="$CPP"
  1586.   fi
  1587.   AC_MSG_RESULT($CPP)
  1588.   AC_SUBST(CPP)dnl
  1589.  
  1590.  
  1591.   AC_MSG_CHECKING(for a C++-Compiler)
  1592.   dnl if there is one, print out. if not, don't matter
  1593.   AC_MSG_RESULT($CXX) 
  1594.  
  1595.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
  1596.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
  1597.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
  1598.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
  1599.   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
  1600.  
  1601.   AC_PROG_CXX_WORKS
  1602.   AC_PROG_CXX_GNU
  1603.  
  1604.   if test $ac_cv_prog_gxx = yes; then
  1605.     GXX=yes
  1606.   else
  1607.     AC_MSG_CHECKING(whether we are using SPARC CC)
  1608.     GXX=
  1609.     cat > conftest.C << EOF
  1610. #ifdef __SUNPRO_CC
  1611.    yes;
  1612. #endif
  1613. EOF
  1614.  
  1615.     ac_try="$CXX -E conftest.C"
  1616.     if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
  1617.       ac_cv_prog_CC=yes
  1618.     else
  1619.       ac_cv_prog_CC=no
  1620.     fi
  1621.     AC_MSG_RESULT($ac_cv_prog_CC)
  1622.     if test "$ac_cv_prog_CC" = "yes"; then
  1623.       AC_MSG_ERROR([Sparc CC doesn't work on KDE sources at least til version
  1624. 4.2. This compiler has several problems accepting legal C++ code 
  1625. including the builtin C++ type bool. Since KDE is a freeware project,
  1626. we decided, that we don't want to support that broken compilers. 
  1627.  
  1628. If you really want to see support for Sparc CC within KDE, make reasonable
  1629. patches and join the KDE project. More information about KDE can be found
  1630. on www.kde.org])
  1631.     fi
  1632.   fi
  1633.  
  1634.   if test -z "$CXXFLAGS"; then 
  1635.     if test "$kde_use_debug_code" = "yes"; then
  1636.       AC_PROG_CXX_G
  1637.       if test $ac_cv_prog_cxx_g = yes; then
  1638.         CXXFLAGS="-g"
  1639.       fi
  1640.       if test "$ac_cv_prog_CC" = "yes"; then
  1641.         CXXFLAGS="$CXXFLAGS -pto"
  1642.       fi
  1643.     else
  1644.       if test "$GXX" = "yes"; then
  1645.          CXXFLAGS="-O2"
  1646.       else
  1647.          if test "$ac_cv_prog_CC" = "yes"; then
  1648.             CXXFLAGS="-pto -O2"
  1649.          else
  1650.             CXXFLAGS=""
  1651.          fi
  1652.       fi
  1653.       if test "$kde_use_debug_define" = "yes"; then
  1654.          CXXFLAGS="$CXXFLAGS -DNDEBUG"
  1655.       fi
  1656.     fi
  1657.  
  1658.     if test "$GXX" = "yes"; then
  1659.        CXXFLAGS="$CXXFLAGS -Wall"
  1660.        
  1661.        if test "$kde_use_debug_code" = "yes"; then
  1662.          CXXFLAGS="$CXXFLAGS -pedantic -W"
  1663.        fi
  1664.  
  1665.        if test "$kde_use_strict_options" = "yes"; then
  1666.     CXXFLAGS="$CXXFLAGS -W -ansi -Wtraditional  -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wbad-function-cast  -Wsynth"
  1667.        fi
  1668.  
  1669.        if test "$kde_very_strict" = "yes"; then
  1670.          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wshadow -Wredundant-decls -Wconversion"
  1671.        fi
  1672.     fi
  1673.   fi  
  1674.  
  1675.     case "$host" in
  1676.       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
  1677.     esac    
  1678.   
  1679.     AC_PROVIDE(AC_PROG_CXXCPP)
  1680.  
  1681.     AC_MSG_CHECKING(how to run the C++ preprocessor)
  1682.     if test -z "$CXXCPP"; then
  1683.       AC_CACHE_VAL(ac_cv_prog_CXXCPP,
  1684.       [
  1685.          AC_LANG_SAVE[]dnl
  1686.          AC_LANG_CPLUSPLUS[]dnl
  1687.          CXXCPP="${CXX-g++} -E"
  1688.          AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
  1689.          ac_cv_prog_CXXCPP="$CXXCPP"
  1690.          AC_LANG_RESTORE[]dnl
  1691.      ])dnl
  1692.      CXXCPP="$ac_cv_prog_CXXCPP"
  1693.      fi
  1694.     AC_MSG_RESULT($CXXCPP)
  1695.     AC_SUBST(CXXCPP)dnl
  1696.     
  1697. ])
  1698.  
  1699. dnl just a wrapper to clean up configure.in
  1700. AC_DEFUN(KDE_PROG_LIBTOOL,
  1701. [
  1702. AC_REQUIRE([AC_CHECK_COMPILERS])
  1703. AC_REQUIRE([AC_ENABLE_SHARED])
  1704. AC_REQUIRE([AC_ENABLE_STATIC])
  1705. dnl libtool is only for C, so I must force him
  1706. dnl to find the correct flags for C++
  1707. dnl kde_save_cc=$CC
  1708. dnl kde_save_cflags="$CFLAGS"
  1709. dnl CC=$CXX
  1710. dnl CFLAGS="$CXXFLAGS"
  1711. AC_LANG_SAVE
  1712. AC_LANG_C
  1713. AM_PROG_LIBTOOL dnl for libraries
  1714. LIBTOOL="$LIBTOOL --silent"
  1715. AC_SUBST(LIBTOOL)
  1716. dnl CC=$kde_save_cc
  1717. dnl CFLAGS="$kde_save_cflags"
  1718. AC_LANG_RESTORE
  1719. ])
  1720.  
  1721. AC_DEFUN(KDE_DO_IT_ALL,
  1722. [
  1723. AC_CANONICAL_SYSTEM 
  1724. AC_ARG_PROGRAM 
  1725. AM_INIT_AUTOMAKE($1, $2)
  1726. AM_DISABLE_LIBRARIES
  1727. AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
  1728. AC_CHECK_COMPILERS
  1729. KDE_PROG_LIBTOOL
  1730. AM_KDE_WITH_NLS
  1731. AC_PATH_KDE
  1732. ])
  1733.  
  1734. AC_DEFUN(AC_CHECK_RPATH,
  1735. [
  1736. AC_MSG_CHECKING(for rpath)
  1737. AC_ARG_ENABLE(rpath,
  1738.       [  --disable-rpath         do not use the rpath feature of ld],
  1739.       USE_RPATH=$enableval, USE_RPATH=yes)
  1740.  
  1741. if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
  1742.  
  1743.   KDE_RPATH="-rpath \$(kde_libraries)"
  1744.  
  1745.   if test -n "$qt_libraries"; then
  1746.     KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)"
  1747.   fi
  1748.   dnl $x_libraries is set to /usr/lib in case
  1749.   if test -n "$X_LDFLAGS"; then 
  1750.     KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)"
  1751.   fi
  1752.   if test -n "$KDE_EXTRA_RPATH"; then
  1753.     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
  1754.   fi
  1755. fi 
  1756. AC_SUBST(KDE_EXTRA_RPATH)
  1757. AC_SUBST(KDE_RPATH)
  1758. AC_MSG_RESULT($USE_RPATH)
  1759. ])
  1760.  
  1761. dnl Check for the type of the third argument of getsockname
  1762. AC_DEFUN(AC_CHECK_KSIZE_T,
  1763. [AC_MSG_CHECKING(for the third argument of getsockname)  
  1764. AC_CACHE_VAL(ac_cv_ksize_t,
  1765. AC_LANG_SAVE
  1766. AC_LANG_CPLUSPLUS
  1767. [AC_TRY_COMPILE([
  1768. #include <sys/types.h>
  1769. #include <sys/socket.h>
  1770. ],[
  1771. socklen_t a=0; 
  1772. getsockname(0,(struct sockaddr*)0, &a);
  1773. ],
  1774. ac_cv_ksize_t=socklen_t,
  1775. ac_cv_ksize_t=)
  1776. if test -z "$ac_cv_ksize_t"; then
  1777. ac_safe_cxxflags="$CXXFLAGS"
  1778. if test "$GCC" = "yes"; then
  1779.   CXXFLAGS="-Werror $CXXFLAGS"
  1780. fi
  1781. AC_TRY_COMPILE([
  1782. #include <sys/types.h>
  1783. #include <sys/socket.h>
  1784. ],[
  1785. int a=0; 
  1786. getsockname(0,(struct sockaddr*)0, &a);
  1787. ],
  1788. ac_cv_ksize_t=int,
  1789. ac_cv_ksize_t=size_t)
  1790. CXXFLAGS="$ac_safe_cxxflags"
  1791. fi
  1792. AC_LANG_RESTORE
  1793. ])
  1794.  
  1795. if test -z "$ac_cv_ksize_t"; then
  1796.   ac_cv_ksize_t=int
  1797. fi
  1798.  
  1799. AC_MSG_RESULT($ac_cv_ksize_t)
  1800. AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t)
  1801.  
  1802. ])
  1803.  
  1804. dnl This is a merge of some macros out of the gettext aclocal.m4
  1805. dnl since we don't need anything, I took the things we need
  1806. dnl the copyright for them is:
  1807. dnl >
  1808. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  1809. dnl This Makefile.in is free software; the Free Software Foundation
  1810. dnl gives unlimited permission to copy and/or distribute it,
  1811. dnl with or without modifications, as long as this notice is preserved.
  1812.  
  1813. dnl This program is distributed in the hope that it will be useful,
  1814. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  1815. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  1816. dnl PARTICULAR PURPOSE.
  1817. dnl >
  1818. dnl for this file it is relicensed under LGPL
  1819.  
  1820. AC_DEFUN(AM_KDE_WITH_NLS,
  1821.   [AC_MSG_CHECKING([whether NLS is requested])
  1822.     dnl Default is enabled NLS
  1823.     AC_ARG_ENABLE(nls,
  1824.       [  --disable-nls           do not use Native Language Support],
  1825.       USE_NLS=$enableval, USE_NLS=yes)
  1826.     AC_MSG_RESULT($USE_NLS)
  1827.     AC_SUBST(USE_NLS)
  1828.  
  1829.     dnl If we use NLS figure out what method
  1830.     if test "$USE_NLS" = "yes"; then
  1831.       AC_DEFINE(ENABLE_NLS)
  1832.  
  1833.       AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, 
  1834.          [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
  1835.       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  1836.  
  1837.       if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
  1838.         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
  1839.         GMSGFMT=":"
  1840.       fi
  1841.       MSGFMT=$GMSGFMT
  1842.       AC_SUBST(GMSGFMT)
  1843.       AC_SUBST(MSGFMT)
  1844.  
  1845.       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
  1846.     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  1847.  
  1848.       dnl Test whether we really found GNU xgettext.
  1849.       if test "$XGETTEXT" != ":"; then
  1850.     dnl If it is no GNU xgettext we define it as : so that the
  1851.     dnl Makefiles still can work.
  1852.     if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  1853.       : ;
  1854.     else
  1855.       AC_MSG_RESULT(
  1856.         [found xgettext programs is not GNU xgettext; ignore it])
  1857.       XGETTEXT=":"
  1858.     fi
  1859.       fi
  1860.      AC_SUBST(XGETTEXT)
  1861.     fi
  1862.  
  1863.   ])
  1864.  
  1865. # Search path for a program which passes the given test.
  1866. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  1867.  
  1868. # serial 1
  1869. # Stephan Kulow: I appended a _KDE against name conflicts
  1870.  
  1871. dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
  1872. dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  1873. AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
  1874. [# Extract the first word of "$2", so it can be a program name with args.
  1875. set dummy $2; ac_word=[$]2
  1876. AC_MSG_CHECKING([for $ac_word])
  1877. AC_CACHE_VAL(ac_cv_path_$1,
  1878. [case "[$]$1" in
  1879.   /*)
  1880.   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  1881.   ;;
  1882.   *)
  1883.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  1884.   for ac_dir in ifelse([$5], , $PATH, [$5]); do
  1885.     test -z "$ac_dir" && ac_dir=.
  1886.     if test -f $ac_dir/$ac_word; then
  1887.       if [$3]; then
  1888.     ac_cv_path_$1="$ac_dir/$ac_word"
  1889.     break
  1890.       fi
  1891.     fi
  1892.   done
  1893.   IFS="$ac_save_ifs"
  1894. dnl If no 4th arg is given, leave the cache variable unset,
  1895. dnl so AC_PATH_PROGS will keep looking.
  1896. ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  1897. ])dnl
  1898.   ;;
  1899. esac])dnl
  1900. $1="$ac_cv_path_$1"
  1901. if test -n "[$]$1"; then
  1902.   AC_MSG_RESULT([$]$1)
  1903. else
  1904.   AC_MSG_RESULT(no)
  1905. fi
  1906. AC_SUBST($1)dnl
  1907. ])
  1908.  
  1909.  
  1910. # Check whether LC_MESSAGES is available in <locale.h>.
  1911. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  1912.  
  1913. # serial 1
  1914.  
  1915. AC_DEFUN(AM_LC_MESSAGES,
  1916.   [if test $ac_cv_header_locale_h = yes; then
  1917.     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  1918.       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  1919.        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  1920.     if test $am_cv_val_LC_MESSAGES = yes; then
  1921.       AC_DEFINE(HAVE_LC_MESSAGES)
  1922.     fi
  1923.   fi])
  1924.  
  1925. dnl From Jim Meyering.
  1926. dnl FIXME: migrate into libit.
  1927.  
  1928. AC_DEFUN(AM_FUNC_OBSTACK,
  1929. [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
  1930.  [AC_TRY_LINK([#include "obstack.h"],
  1931.           [struct obstack *mem;obstack_free(mem,(char *) 0)],
  1932.           am_cv_func_obstack=yes,
  1933.           am_cv_func_obstack=no)])
  1934.  if test $am_cv_func_obstack = yes; then
  1935.    AC_DEFINE(HAVE_OBSTACK)
  1936.  else
  1937.    LIBOBJS="$LIBOBJS obstack.o"
  1938.  fi
  1939. ])
  1940.  
  1941. dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
  1942. dnl FIXME: Migrate into libit
  1943.  
  1944. AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
  1945. [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
  1946.  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
  1947.               am_cv_lib_error_at_line=yes,
  1948.           am_cv_lib_error_at_line=no)])
  1949.  if test $am_cv_lib_error_at_line = no; then
  1950.    LIBOBJS="$LIBOBJS error.o"
  1951.  fi
  1952.  AC_SUBST(LIBOBJS)dnl
  1953. ])
  1954.  
  1955. # Macro to add for using GNU gettext.
  1956. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  1957.  
  1958. # serial 1
  1959. # Stephan Kulow: I put a KDE in it to avoid name conflicts
  1960.  
  1961. AC_DEFUN(AM_KDE_GNU_GETTEXT,
  1962.   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  1963.    AC_REQUIRE([AC_PROG_RANLIB])dnl
  1964.    AC_REQUIRE([AC_HEADER_STDC])dnl
  1965.    AC_REQUIRE([AC_C_INLINE])dnl
  1966.    AC_REQUIRE([AC_TYPE_OFF_T])dnl
  1967.    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  1968.    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  1969.    AC_REQUIRE([AC_FUNC_MMAP])dnl
  1970.    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
  1971.    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
  1972. unistd.h values.h alloca.h])
  1973.    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
  1974. __argz_count __argz_stringify __argz_next stpcpy])
  1975.  
  1976.    AM_LC_MESSAGES
  1977.  
  1978.    if test "x$CATOBJEXT" != "x"; then
  1979.      if test "x$ALL_LINGUAS" = "x"; then
  1980.        LINGUAS=
  1981.      else
  1982.        AC_MSG_CHECKING(for catalogs to be installed)
  1983.        NEW_LINGUAS=
  1984.        for lang in ${LINGUAS=$ALL_LINGUAS}; do
  1985.          case "$ALL_LINGUAS" in
  1986.           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  1987.          esac
  1988.        done
  1989.        LINGUAS=$NEW_LINGUAS
  1990.        AC_MSG_RESULT($LINGUAS)
  1991.      fi
  1992.  
  1993.      dnl Construct list of names of catalog files to be constructed.
  1994.      if test -n "$LINGUAS"; then
  1995.        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  1996.      fi
  1997.    fi
  1998.  
  1999.   ])
  2000.  
  2001. AC_DEFUN(AC_HAVE_XPM,
  2002.  [AC_REQUIRE_CPP()dnl
  2003.   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2004.  
  2005.  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
  2006.  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
  2007.  
  2008.  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
  2009.     xpm_test=$withval, xpm_test="yes")
  2010.  if test "x$xpm_test" = xno; then
  2011.    ac_cv_have_xpm=no
  2012.  else
  2013.    AC_MSG_CHECKING(for XPM)
  2014.    AC_CACHE_VAL(ac_cv_have_xpm,
  2015.    [
  2016.     AC_LANG_C
  2017.     ac_save_ldflags="$LDFLAGS"
  2018.     ac_save_cflags="$CFLAGS"
  2019.     LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET"
  2020.     CFLAGS="$CFLAGS $X_INCLUDES"
  2021.     test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
  2022.     AC_TRY_LINK([#include <X11/xpm.h>],[],
  2023.     ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
  2024.     LDFLAGS="$ac_save_ldflags"
  2025.     CFLAGS="$ac_save_cflags"
  2026.    ])dnl
  2027.  
  2028.   if test "$ac_cv_have_xpm" = no; then
  2029.     AC_MSG_RESULT(no)
  2030.     XPM_LDFLAGS=""
  2031.     XPMINC=""
  2032.     $2
  2033.   else
  2034.     AC_DEFINE(HAVE_XPM)
  2035.     if test "$XPM_LDFLAGS" = ""; then
  2036.        XPMLIB='-lXpm $(LIB_X11)'
  2037.     else
  2038.        XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
  2039.     fi
  2040.     if test "$XPM_INCLUDE" = ""; then
  2041.        XPMINC=""
  2042.     else
  2043.        XPMINC="-I$XPM_INCLUDE"
  2044.     fi
  2045.     AC_MSG_RESULT(yes)
  2046.     $1
  2047.   fi
  2048.  fi
  2049.  AC_SUBST(XPMINC)
  2050.  AC_SUBST(XPMLIB)
  2051. ]) 
  2052.  
  2053. AC_DEFUN(AC_HAVE_GL,
  2054.  [AC_REQUIRE_CPP()dnl
  2055.   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2056.  
  2057.  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
  2058.  test -z "$GL_INCLUDE" && GL_INCLUDE=
  2059.  
  2060.  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
  2061.     gl_test=$withval, gl_test="yes")
  2062.  if test "x$gl_test" = xno; then
  2063.    ac_cv_have_gl=no
  2064.  else
  2065.    AC_MSG_CHECKING(for GL)
  2066.    AC_CACHE_VAL(ac_cv_have_gl,
  2067.    [
  2068.     AC_LANG_C
  2069.     ac_save_ldflags="$LDFLAGS"
  2070.     ac_save_cflags="$CFLAGS"
  2071.     LDFLAGS="$LDFLAGS $GL_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
  2072.     CFLAGS="$CFLAGS $X_INCLUDES"
  2073.     test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
  2074.     AC_TRY_LINK([],[],
  2075.     ac_cv_have_gl="yes",ac_cv_have_gl="no")
  2076.     LDFLAGS="$ac_save_ldflags"
  2077.     CFLAGS="$ac_save_cflags"
  2078.    ])dnl
  2079.  
  2080.   if test "$ac_cv_have_gl" = no; then
  2081.     AC_MSG_RESULT(no)
  2082.     GL_LDFLAGS=""
  2083.     GLINC=""
  2084.     $2
  2085.   else
  2086.     AC_DEFINE(HAVE_GL)
  2087.     if test "$GL_LDFLAGS" = ""; then
  2088.        GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)'
  2089.     else
  2090.        GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)'
  2091.     fi
  2092.     if test "$GL_INCLUDE" = ""; then
  2093.        GLINC=""
  2094.     else
  2095.        GLINC="-I$GL_INCLUDE"
  2096.     fi
  2097.     AC_MSG_RESULT(yes)
  2098.     $1
  2099.   fi
  2100.  fi
  2101.  AC_SUBST(GLINC)
  2102.  AC_SUBST(GLLIB)
  2103. ]) 
  2104.  
  2105.  dnl PAM pam
  2106.  
  2107.  dnl Should test for PAM (Pluggable Authentication Modules)
  2108.  AC_DEFUN(AC_PATH_PAM_DIRECT,
  2109.  [
  2110.  test -z "$pam_direct_test_library" && pam_direct_test_library=pam
  2111.  test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
  2112.  
  2113.    for ac_dir in               \
  2114.                                \
  2115.      /usr/local/include        \
  2116.      /usr/include              \
  2117.      /usr/unsupported/include  \
  2118.      /opt/include              \
  2119.      /usr/pam/include          \
  2120.      /usr/local/pam/include    \
  2121.      /usr/lib/pam/include      \
  2122.                    \
  2123.      $extra_include            \
  2124.      ; \
  2125.    do
  2126.      if test -r "$ac_dir/$pam_direct_test_include"; then
  2127.        no_pam= ac_pam_includes=$ac_dir
  2128.        break
  2129.      fi
  2130.    done
  2131.  
  2132.  # First see if replacing the include by lib works.
  2133.  for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \
  2134.                            \
  2135.      /lib                  \
  2136.      /usr/lib              \
  2137.      /usr/local/lib        \
  2138.      /usr/unsupported/lib  \
  2139.      /lib/security         \
  2140.      /usr/security/lib     \
  2141.      $extra_lib            \
  2142.      ; \
  2143.  do
  2144.    for ac_extension in a so sl; do
  2145.      if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
  2146.        no_pam= ac_pam_libraries=$ac_dir
  2147.        break 2
  2148.      fi
  2149.    done
  2150.  done
  2151. ])
  2152.  
  2153. AC_DEFUN(AC_PATH_PAM,
  2154.  [
  2155.   AC_REQUIRE([KDE_CHECK_LIBDL])
  2156.   AC_REQUIRE_CPP()dnl
  2157.  
  2158.   AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"], [], [-lpam $LIBDL])
  2159.  
  2160.  AC_MSG_CHECKING(for PAM)
  2161.  AC_ARG_WITH(pam, 
  2162. [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
  2163.   [
  2164.     if test "x$withval" = "xyes"; then
  2165.       no_pam=
  2166.       default_pam=yes
  2167.     elif test "x$withval" = "xno"; then
  2168.       no_pam=yes
  2169.     else
  2170.       no_pam=
  2171.       pam_service="$withval"
  2172.         if test -z "$pam_service"; then
  2173.         default_pam=yes
  2174.         else
  2175.         default_pam=
  2176.         fi 
  2177.       fi
  2178.   ], no_pam=yes
  2179.  )
  2180.  
  2181.  if test ! "$no_pam" = yes; then
  2182.  
  2183.  AC_CACHE_VAL(ac_cv_path_pam,
  2184.  [
  2185.  ac_pam_includes=NONE
  2186.  ac_pam_libraries=NONE
  2187.  if test -z "$pam_libraries"; then
  2188.    pam_libraries=NONE
  2189.  fi
  2190.  if test -z "$pam_includes"; then
  2191.    pam_includes=NONE
  2192.  fi
  2193.  
  2194.  AC_PATH_PAM_DIRECT
  2195.  
  2196.  test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
  2197.  test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
  2198.  
  2199.  if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
  2200.    ac_pam_libs="-lpam $PAM_MISC_LIB $LIBDL"
  2201.    ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\""
  2202.  else
  2203.    ac_cv_path_pam="no_pam=yes"
  2204.  fi
  2205.  ])
  2206.  
  2207.  eval "$ac_cv_path_pam"
  2208.  
  2209.  fi
  2210.  
  2211.  if test "$no_pam" = yes; then
  2212.    AC_MSG_RESULT(no)
  2213.  else
  2214.    AC_DEFINE(HAVE_PAM)
  2215.    PAMLIBS="$ac_pam_libs"
  2216.    test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
  2217.    test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
  2218.    AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
  2219.  if test "$default_pam" = yes; then
  2220.    AC_MSG_RESULT(["default pam service name will be used"])
  2221.  else
  2222.    AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service")
  2223.    AC_MSG_RESULT(["pam service name will be: " $pam_service])
  2224.  fi
  2225. dnl test whether struct pam_message is const (Linux) or not (Sun)
  2226.    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
  2227.    AC_MSG_CHECKING(for const pam_message)
  2228.    AC_EGREP_HEADER([struct pam_message],
  2229.       $pam_appl_h,
  2230.       [ AC_EGREP_HEADER([const struct pam_message],
  2231.                         $pam_appl_h,
  2232.                         [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
  2233.                         [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
  2234.                         AC_DEFINE(PAM_MESSAGE_NONCONST)] 
  2235.                         )],
  2236.        [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
  2237.        )
  2238.  fi
  2239.  
  2240.  if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
  2241.      PAMLIBPATHS="-L$pam_libraries"
  2242.  fi
  2243.  if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
  2244.      PAMINC="-I$pam_includes"
  2245.  fi
  2246.  
  2247.  AC_SUBST(PAMINC)
  2248.  AC_SUBST(PAMLIBS)
  2249.  AC_SUBST(PAMLIBPATHS)
  2250.  
  2251. ]) 
  2252.  
  2253. AC_DEFUN(KDE_CHECK_LIBDL,
  2254. [
  2255. AC_CHECK_LIB(dl, dlopen, [
  2256. LIBDL="-ldl"
  2257. ac_cv_have_dlfcn=yes
  2258. ])
  2259.  
  2260. AC_CHECK_LIB(dld, shl_unload, [
  2261. LIBDL="-ldld"
  2262. ac_cv_have_shload=yes
  2263. ])
  2264.  
  2265. AC_SUBST(LIBDL)
  2266. ])
  2267.  
  2268. AC_DEFUN(KDE_CHECK_DLOPEN,
  2269. [
  2270. KDE_CHECK_LIBDL
  2271. AC_CHECK_HEADERS(dlfcn.h dl.h)
  2272. if test "$ac_cv_header_dlfcn_h" = "no"; then
  2273.   ac_cv_have_dlfcn=no
  2274. fi
  2275.  
  2276. if test "$ac_cv_header_dl_h" = "no"; then
  2277.   ac_cv_have_shload=no
  2278. fi
  2279.  
  2280. enable_dlopen=no
  2281. AC_ARG_ENABLE(dlopen,
  2282. [  --disable-dlopen        link staticly [default=no]] ,
  2283. [if test "$enableval" = yes; then
  2284.   enable_dlopen=yes
  2285. fi],
  2286. enable_dlopen=yes)
  2287.  
  2288. # override the user's opinion, if we know it better ;)
  2289. if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
  2290.   enable_dlopen=no
  2291. fi
  2292.  
  2293. if test "$ac_cv_have_dlfcn" = "yes"; then
  2294.   AC_DEFINE_UNQUOTED(HAVE_DLFCN)
  2295. fi
  2296.  
  2297. if test "$ac_cv_have_shload" = "yes"; then
  2298.   AC_DEFINE_UNQUOTED(HAVE_SHLOAD)
  2299. fi
  2300.  
  2301. if test "$enable_dlopen" = no ; then
  2302.   test -n "$1" && eval $1
  2303. else
  2304.   test -n "$2" && eval $2
  2305. fi
  2306.  
  2307. ])
  2308.  
  2309. AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
  2310. [
  2311. KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no)
  2312. KDE_PROG_LIBTOOL
  2313. AC_MSG_CHECKING([dynamic loading])
  2314. eval "`egrep '^build_libtool_libs=' libtool`"
  2315. if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
  2316.   dynamic_loading=yes
  2317.   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
  2318. else
  2319.   dynamic_loading=no
  2320. fi
  2321. AC_MSG_RESULT($dynamic_loading)
  2322. if test "$dynamic_loading" = "yes"; then
  2323.   $1
  2324. else
  2325.   $2
  2326. fi
  2327. ])
  2328.  
  2329. AC_DEFUN(KDE_ADD_INCLUDES,
  2330. [
  2331. if test -z "$1"; then 
  2332.   test_include="Pix.h"
  2333. else
  2334.   test_include="$1"
  2335. fi
  2336.  
  2337. AC_MSG_CHECKING([for libg++ ($test_include)])
  2338.  
  2339. AC_CACHE_VAL(kde_cv_libgpp_includes,
  2340. [
  2341. kde_cv_libgpp_includes=no
  2342.  
  2343.    for ac_dir in               \
  2344.                                \
  2345.      /usr/include/g++          \
  2346.      /usr/include              \
  2347.      /usr/unsupported/include  \
  2348.      /opt/include              \
  2349.      $extra_include            \
  2350.      ; \
  2351.    do
  2352.      if test -r "$ac_dir/$test_include"; then
  2353.        kde_cv_libgpp_includes=$ac_dir
  2354.        break
  2355.      fi
  2356.    done
  2357. ])
  2358.  
  2359. AC_MSG_RESULT($kde_cv_libgpp_includes)
  2360. if test "$kde_cv_libgpp_includes" != "no"; then
  2361.   all_includes="-I$kde_cv_libgpp_includes $all_includes"
  2362. fi
  2363. ])
  2364. ])
  2365.  
  2366.  
  2367. AC_DEFUN(KDE_CHECK_MICO,
  2368. [
  2369. AC_REQUIRE([KDE_CHECK_LIBDL])
  2370. AC_REQUIRE([KDE_MISC_TESTS])
  2371. AC_MSG_CHECKING(for MICO)
  2372.  
  2373. if test -z "$MICODIR"; then
  2374.     kde_micodir=/usr/local
  2375.  else
  2376.     kde_micodir="$MICODIR"
  2377. fi
  2378.  
  2379. AC_ARG_WITH(micodir,
  2380.   [  --with-micodir=micodir  where mico is installed ],
  2381.   kde_micodir=$withval,
  2382.   kde_micodir=$kde_micodir
  2383. )
  2384.  
  2385. AC_CACHE_VAL(kde_cv_mico_incdir,
  2386. [
  2387.   mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include"
  2388. AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir)
  2389.  
  2390. ])
  2391. kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'`
  2392.  
  2393. if test ! -r  $kde_micodir/include/CORBA.h; then
  2394.   AC_MSG_ERROR([No CORBA.h found, specify another micodir])
  2395. fi
  2396.  
  2397. AC_MSG_RESULT($kde_micodir)
  2398.  
  2399. MICO_INCLUDES=-I$kde_micodir/include
  2400. AC_SUBST(MICO_INCLUDES)
  2401. MICO_LDFLAGS=-L$kde_micodir/lib
  2402. AC_SUBST(MICO_LDFLAGS)
  2403.  
  2404. AC_MSG_CHECKING([for MICO version])
  2405. AC_CACHE_VAL(kde_cv_mico_version,
  2406. [
  2407. AC_LANG_C
  2408. cat >conftest.$ac_ext <<EOF
  2409. #include <stdio.h>
  2410. #include <mico/version.h>
  2411. int main() { 
  2412.     
  2413.    printf("MICO_VERSION=%s\n",MICO_VERSION); 
  2414.    return (0); 
  2415. }
  2416. EOF
  2417. ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
  2418. if AC_TRY_EVAL(ac_compile); then
  2419.   if eval `./conftest 2>&5`; then
  2420.     kde_cv_mico_version=$MICO_VERSION
  2421.   else
  2422.     AC_MSG_ERROR([your system is not able to execute a small application to
  2423.     find MICO version! Check $kde_micodir/include/mico/version.h])
  2424.   fi 
  2425. else
  2426.   AC_MSG_ERROR([your system is not able to compile a small application to
  2427.   find MICO version! Check $kde_micodir/include/mico/version.h])
  2428. fi
  2429. ])
  2430.  
  2431. dnl installed MICO version
  2432. mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
  2433. mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
  2434. mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
  2435.  
  2436. dnl required MICO version
  2437. req_v_maj=`echo $1 | sed -e 's/^\(.*\)\..*\..*$/\1/'`
  2438. req_v_mid=`echo $1 | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
  2439. req_v_min=`echo $1 | sed -e 's/^.*\..*\.\(.*\)$/\1/'` 
  2440.  
  2441. if test "$mico_v_maj" -lt "$req_v_maj" || \
  2442.    ( test "$mico_v_maj" -eq "$req_v_maj" && \
  2443.         test "$mico_v_mid" -lt "$req_v_mid" ) || \
  2444.    ( test "$mico_v_mid" -eq "$req_v_mid" && \
  2445.         test "$mico_v_min" -lt "$req_v_min" )
  2446.  
  2447. then
  2448.   AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $1 \
  2449. at least is required. You should upgrade MICO.])
  2450. else
  2451.   AC_MSG_RESULT([$kde_cv_mico_version (minimum version $1, ok)])
  2452. fi
  2453.  
  2454. LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBDL"
  2455. AC_SUBST(LIBMICO)
  2456. IDL=$kde_micodir/bin/idl
  2457. AC_SUBST(IDL)
  2458.  
  2459. KDE_CHECK_MINI_STL
  2460.  
  2461. if test "$kde_cv_have_mini_stl" = "yes"; then
  2462.   AC_MSG_ERROR([compile mico with --disable-mini-stl])
  2463. fi
  2464.  
  2465. idldir="\$(includedir)/idl"
  2466. AC_SUBST(idldir)
  2467.  
  2468. ])
  2469.  
  2470. AC_DEFUN(KDE_CHECK_MINI_STL,
  2471. [
  2472. AC_REQUIRE([KDE_CHECK_MICO])
  2473.  
  2474. AC_MSG_CHECKING(if we use mico's mini-STL)
  2475. AC_CACHE_VAL(kde_cv_have_mini_stl,
  2476. [
  2477. AC_LANG_SAVE
  2478. AC_LANG_CPLUSPLUS
  2479. kde_save_cxxflags="$CXXFLAGS"
  2480. CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
  2481. AC_TRY_COMPILE(
  2482. [
  2483. #include <mico/config.h>
  2484. ],
  2485. [
  2486. #ifdef HAVE_MINI_STL
  2487. #error "nothing"
  2488. #endif
  2489. ],
  2490. kde_cv_have_mini_stl=no,
  2491. kde_cv_have_mini_stl=yes)
  2492. CXXFLAGS="$kde_save_cxxflags"
  2493. AC_LANG_RESTORE
  2494. ])
  2495.  
  2496.  
  2497. AC_MSG_RESULT($kde_cv_have_mini_stl)
  2498. ])
  2499.  
  2500. ])
  2501.  
  2502.  
  2503. AC_DEFUN(KDE_CHECK_LIBPTHREAD,
  2504. [
  2505. AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"], LIBPTHREAD= )
  2506. AC_SUBST(LIBPTHREAD)
  2507. ])
  2508.  
  2509. AC_DEFUN(KDE_TRY_LINK_PYTHON,
  2510. [
  2511. if test "$kde_python_link_found" = no; then
  2512.   
  2513. if test "$1" = normal; then
  2514.   AC_MSG_CHECKING(if a Python application links)
  2515. else
  2516.   AC_MSG_CHECKING(if Python depends on $2)
  2517. fi
  2518.  
  2519. AC_CACHE_VAL(kde_cv_try_link_python_$1,
  2520. [
  2521. AC_LANG_SAVE
  2522. AC_LANG_C
  2523. kde_save_cflags="$CFLAGS"
  2524. CFLAGS="$CFLAGS $PYTHONINC"
  2525. kde_save_libs="$LIBS"
  2526. LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
  2527. kde_save_ldflags="$LDFLAGS"
  2528. LDFLAGS="$LDFLAGS $PYTHONLIB"
  2529.  
  2530. AC_TRY_LINK(
  2531. [
  2532. #include <Python.h>
  2533. ],[
  2534.     PySys_SetArgv(1, 0);
  2535. ],
  2536.     [kde_cv_try_link_python_$1=yes],
  2537.     [kde_cv_try_link_python_$1=no]
  2538. )
  2539. CFLAGS="$kde_save_cflags"
  2540. LIBS="$kde_save_libs"
  2541. LDFLAGS="$kde_save_ldflags"
  2542. ])
  2543.  
  2544. if test "$kde_cv_try_link_python_$1" = "yes"; then
  2545.   AC_MSG_RESULT(yes)
  2546.   kde_python_link_found=yes
  2547.   if test ! "$1" = normal; then
  2548.     LIBPYTHON="$LIBPYTHON $2"
  2549.   fi
  2550.   $3
  2551. else
  2552.   AC_MSG_RESULT(no)
  2553.   $4
  2554. fi
  2555. AC_LANG_RESTORE
  2556.  
  2557. fi
  2558.  
  2559. ])
  2560.  
  2561. AC_DEFUN(KDE_CHECK_PYTHON,
  2562. [
  2563. AC_REQUIRE([KDE_CHECK_LIBDL])
  2564. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  2565.  
  2566. AC_MSG_CHECKING([for Python directory])
  2567.  
  2568. AC_CACHE_VAL(kde_cv_pythondir,
  2569. [
  2570.   if test -z "$PYTHONDIR"; then
  2571.     kde_cv_pythondir=/usr/local
  2572.   else
  2573.     kde_cv_pythondir="$PYTHONDIR"
  2574.   fi
  2575. ])
  2576.  
  2577. AC_ARG_WITH(pythondir, 
  2578. [  --with-pythondir=pythondir   use python installed in pythondir ],
  2579. [
  2580.   ac_python_dir=$withval
  2581. ], ac_python_dir=$kde_cv_pythondir
  2582. )
  2583.  
  2584. AC_MSG_RESULT($ac_python_dir)
  2585.  
  2586. if test -z "$1"; then 
  2587.   version="1.5"
  2588. else
  2589.   version="$1"
  2590. fi
  2591.  
  2592. AC_MSG_CHECKING([for Python$version])
  2593.  
  2594. python_incdirs="$ac_python_dir/include/python$version /usr/include/python$version /usr/local/include/python$version /usr/local/include"
  2595. AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
  2596. if test ! -r $python_incdir/Python.h; then
  2597.   AC_MSG_ERROR(Python.h not found.)
  2598. fi
  2599.  
  2600. PYTHONINC=-I$python_incdir
  2601.  
  2602. python_libdirs="$ac_python_dir/lib/python$version/config /usr/lib/python$version/config /usr/local/python$version/config /usr/lib"
  2603. AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
  2604. if test ! -r $python_libdir/libpython$version.a; then
  2605.   AC_MSG_ERROR(libpython$version.a not found.)
  2606. fi
  2607.  
  2608. PYTHONLIB=-L$python_libdir
  2609. if test -z "$LIBPYTHON"; then
  2610. LIBPYTHON=-lpython$version
  2611. fi
  2612.  
  2613. AC_MSG_RESULT(header $python_incdir library $python_libdir)
  2614.  
  2615. dnl Note: this test is very weak
  2616. kde_python_link_found=no
  2617. KDE_TRY_LINK_PYTHON(normal)
  2618. KDE_TRY_LINK_PYTHON(m, -lm)
  2619. KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
  2620. KDE_TRY_LINK_PYTHON(tcl, -ltcl)
  2621. KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm], [],
  2622.     [AC_MSG_WARN([it seems, Python depends on another library. 
  2623.     Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this
  2624.     and contact the authors to let them know about this problem])
  2625.     ])
  2626.  
  2627. LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
  2628. AC_SUBST(PYTHONINC)
  2629. AC_SUBST(PYTHONLIB)
  2630. AC_SUBST(LIBPYTHON)
  2631.  
  2632. ])
  2633.  
  2634.  
  2635. AC_DEFUN(KDE_CHECK_STL_SGI,
  2636. [
  2637.     AC_MSG_CHECKING([if STL implementation is SGI like])
  2638.     AC_CACHE_VAL(kde_cv_stl_type_sgi,
  2639.     [
  2640.       AC_TRY_COMPILE([
  2641. #include <string>
  2642. ],[
  2643.   string astring="Hallo Welt.";
  2644.   astring.erase(0, 6); // now astring is "Welt"
  2645.   return 0;
  2646. ], kde_cv_stl_type_sgi=yes,
  2647.    kde_cv_stl_type_sgi=no)
  2648. ])
  2649.  
  2650.    AC_MSG_RESULT($kde_cv_stl_type_sgi)
  2651.  
  2652.    if test "$kde_cv_stl_type_sgi" = "yes"; then
  2653.     AC_DEFINE_UNQUOTED(HAVE_SGI_STL) 
  2654.    fi
  2655. ])
  2656.  
  2657. AC_DEFUN(KDE_CHECK_STL_HP,
  2658. [
  2659.     AC_MSG_CHECKING([if STL implementation is HP like])
  2660.     AC_CACHE_VAL(kde_cv_stl_type_hp,
  2661.     [
  2662.       AC_TRY_COMPILE([
  2663. #include <string>
  2664. ],[
  2665.   string astring="Hello World";
  2666.   astring.remove(0, 6); // now astring is "World"
  2667.   return 0;
  2668. ], kde_cv_stl_type_hp=yes,
  2669.    kde_cv_stl_type_hp=no)
  2670. ])
  2671.    AC_MSG_RESULT($kde_cv_stl_type_hp)
  2672.  
  2673.    if test "$kde_cv_stl_type_hp" = "yes"; then
  2674.     AC_DEFINE_UNQUOTED(HAVE_HP_STL) 
  2675.    fi
  2676. ])
  2677.  
  2678. AC_DEFUN(KDE_CHECK_STL,
  2679. [
  2680.     AC_LANG_SAVE
  2681.     AC_LANG_CPLUSPLUS
  2682.     KDE_CHECK_STL_SGI
  2683.     
  2684.     if test "$kde_cv_stl_type_sgi" = "no"; then
  2685.        KDE_CHECK_STL_HP
  2686.  
  2687.        if test "$kde_cv_stl_type_hp" = "no"; then
  2688.          AC_MSG_ERROR("no known STL type found")
  2689.        fi
  2690.     fi
  2691.  
  2692.     AC_LANG_RESTORE
  2693. ])
  2694.  
  2695. AC_DEFUN(AC_FIND_QIMGIO,
  2696.    [AC_REQUIRE([AC_FIND_JPEG])
  2697. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2698. AC_MSG_CHECKING([for qimgio])
  2699. AC_CACHE_VAL(ac_cv_lib_qimgio,
  2700. [
  2701. AC_LANG_SAVE
  2702. AC_LANG_CPLUSPLUS
  2703. ac_save_LIBS="$LIBS"
  2704. LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
  2705. AC_TRY_LINK(dnl
  2706. [
  2707. void qInitImageIO ();
  2708. ],
  2709.             [qInitImageIO();],
  2710.             eval "ac_cv_lib_qimgio=yes",
  2711.             eval "ac_cv_lib_qimgio=no")
  2712. LIBS="$ac_save_LIBS"
  2713. AC_LANG_RESTORE
  2714. ])dnl
  2715. if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
  2716.   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
  2717.   AC_MSG_RESULT(yes)
  2718.   AC_DEFINE_UNQUOTED(HAVE_QIMGIO)
  2719.   AC_SUBST(LIBQIMGIO)
  2720. else
  2721.   AC_MSG_RESULT(not found)
  2722. fi
  2723. ])
  2724.  
  2725. AC_DEFUN(KDE_CHECK_ANSI,
  2726. [
  2727. ])
  2728.  
  2729. AC_DEFUN(KDE_CHECK_INSURE,
  2730. [
  2731.   AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
  2732.   [
  2733.   if test $enableval = "no"; dnl
  2734.     then ac_use_insure="no"
  2735.     else ac_use_insure="yes"
  2736.    fi
  2737.   ], [ac_use_insure="no"])
  2738.  
  2739.   AC_MSG_CHECKING(if we will use Insure++ to debug)
  2740.   AC_MSG_RESULT($ac_use_insure)
  2741.   if test "$ac_use_insure" = "yes"; dnl
  2742.        then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
  2743.    fi
  2744. ])          
  2745.  
  2746. AC_DEFUN(AM_DISABLE_LIBRARIES,
  2747. [
  2748.     AC_PROVIDE([AM_ENABLE_STATIC])
  2749.     AC_PROVIDE([AM_ENABLE_SHARED])
  2750.     enable_static=no
  2751.     enable_shared=yes
  2752. ])
  2753.  
  2754.  
  2755. AC_DEFUN(AC_CHECK_UTMP_FILE,
  2756. [
  2757.     AC_MSG_CHECKING([for utmp file])
  2758.  
  2759.     AC_CACHE_VAL(kde_cv_utmp_file,
  2760.     [
  2761.     kde_cv_utmp_file=no
  2762.  
  2763.     for ac_file in    \
  2764.                       \
  2765.     /var/run/utmp \
  2766.     /var/adm/utmp \
  2767.     /etc/utmp     \
  2768.      ; \
  2769.     do
  2770.      if test -r "$ac_file"; then
  2771.        kde_cv_utmp_file=$ac_file
  2772.        break
  2773.      fi
  2774.     done
  2775.     ])
  2776.  
  2777.     AC_MSG_RESULT($kde_cv_utmp_file)
  2778.     if test "$kde_cv_utmp_file" != "no"; then
  2779.     AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file")
  2780.     fi
  2781. ])
  2782.  
  2783.  
  2784. AC_DEFUN(KDE_CREATE_SUBDIRSLIST,
  2785. [
  2786.  
  2787. DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
  2788.  
  2789. if test ! -s $srcdir/inst-apps && test -s $srcdir/subdirs; then
  2790.  cp $srcdir/subdirs $srcdir/inst-apps
  2791. fi
  2792.  
  2793. if test ! -s $srcdir/inst-apps; then
  2794.   TOPSUBDIRS=""
  2795.   files=`cd $srcdir && ls -1`
  2796.   dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
  2797.   for i in $dirs; do 
  2798.     echo $i >> $srcdir/subdirs
  2799.   done
  2800.   cp $srcdir/subdirs $srcdir/inst-apps
  2801. fi    
  2802.  
  2803. if test -s $srcdir/inst-apps; then
  2804.   ac_topsubdirs="`cat $srcdir/inst-apps`"
  2805. fi  
  2806.  
  2807. for i in $ac_topsubdirs; do
  2808.   AC_MSG_CHECKING([if $i should be compiled])
  2809.   if test -d $srcdir/$i; then
  2810.     install_it="yes"
  2811.     for j in $DO_NOT_COMPILE; do 
  2812.       if test $i = $j; then
  2813.         install_it="no"
  2814.       fi
  2815.     done
  2816.   else
  2817.     install_it="no"
  2818.   fi
  2819.   AC_MSG_RESULT($install_it)
  2820.   if test $install_it = "yes"; then 
  2821.     TOPSUBDIRS="$TOPSUBDIRS $i"
  2822.   fi
  2823. done
  2824.  
  2825. AC_SUBST(TOPSUBDIRS)
  2826. ])
  2827.  
  2828. AC_DEFUN(KDE_CHECK_NAMESPACES,
  2829. [
  2830. AC_MSG_CHECKING(whether C++ compiler supports namespaces)
  2831. AC_LANG_SAVE
  2832. AC_LANG_CPLUSPLUS
  2833. AC_TRY_COMPILE([
  2834. ],
  2835. [
  2836. namespace Foo {
  2837.   extern int i;
  2838.   namespace Bar {
  2839.     extern int i;
  2840.   }
  2841. }
  2842.  
  2843. int Foo::i = 0;
  2844. int Foo::Bar::i = 1;
  2845. ],[
  2846.   AC_MSG_RESULT(yes)
  2847.   AC_DEFINE(HAVE_NAMESPACES)
  2848. ], [
  2849. AC_MSG_RESULT(no)
  2850. ])
  2851. AC_LANG_RESTORE
  2852. ])
  2853.  
  2854. AC_DEFUN(KDE_CHECK_NEWLIBS,
  2855. [
  2856.  
  2857. ])
  2858.  
  2859. dnl ------------------------------------------------------------------------
  2860. dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
  2861. dnl ------------------------------------------------------------------------
  2862. dnl
  2863. AC_DEFUN(AC_CHECK_S_ISSOCK,
  2864. [
  2865. AC_MSG_CHECKING(for S_ISSOCK)
  2866. AC_CACHE_VAL(ac_cv_have_s_issock,
  2867. [
  2868. AC_LANG_SAVE
  2869. AC_LANG_C
  2870. AC_TRY_LINK(
  2871. [
  2872. #include <sys/stat.h>
  2873. ],
  2874. [
  2875. struct stat buff;
  2876. int b = S_ISSOCK( buff.st_mode );
  2877. ],
  2878. ac_cv_have_s_issock=yes,
  2879. ac_cv_have_s_issock=no)
  2880. AC_LANG_RESTORE 
  2881. ])
  2882. AC_MSG_RESULT($ac_cv_have_s_issock)
  2883. if test "$ac_cv_have_s_issock" = "yes"; then
  2884.   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK)
  2885. fi
  2886. ])
  2887.  
  2888. dnl ------------------------------------------------------------------------
  2889. dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
  2890. dnl ------------------------------------------------------------------------
  2891. dnl
  2892. AC_DEFUN(AC_CHECK_KDEMAXPATHLEN,
  2893. [
  2894. AC_MSG_CHECKING(for MAXPATHLEN)
  2895. AC_CACHE_VAL(ac_cv_maxpathlen,
  2896. [
  2897. AC_LANG_C
  2898. cat > conftest.$ac_ext <<EOF
  2899. #include <stdio.h>
  2900. #include <sys/param.h>
  2901. #ifndef MAXPATHLEN
  2902. #define MAXPATHLEN 1024
  2903. #endif
  2904.  
  2905. KDE_HELLO MAXPATHLEN
  2906.  
  2907. EOF
  2908.  
  2909. ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
  2910.  
  2911. if AC_TRY_EVAL(ac_try) && test -s conftest.out; then 
  2912.     ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
  2913. else
  2914.     ac_cv_maxpathlen=1024
  2915. fi
  2916.  
  2917. rm conftest.*
  2918.  
  2919. ])
  2920. AC_MSG_RESULT($ac_cv_maxpathlen)
  2921. AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen)
  2922. ])
  2923.  
  2924. ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
  2925. ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
  2926. ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  2927. ##
  2928. ## This program is free software; you can redistribute it and/or modify
  2929. ## it under the terms of the GNU General Public License as published by
  2930. ## the Free Software Foundation; either version 2 of the License, or
  2931. ## (at your option) any later version.
  2932. ##
  2933. ## This program is distributed in the hope that it will be useful, but
  2934. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  2935. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  2936. ## General Public License for more details.
  2937. ##
  2938. ## You should have received a copy of the GNU General Public License
  2939. ## along with this program; if not, write to the Free Software
  2940. ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  2941. ##
  2942. ## As a special exception to the GNU General Public License, if you
  2943. ## distribute this file as part of a program that contains a
  2944. ## configuration script generated by Autoconf, you may include it under
  2945. ## the same distribution terms that you use for the rest of that program.
  2946.  
  2947. # serial 39 AC_PROG_LIBTOOL
  2948. AC_DEFUN(AC_PROG_LIBTOOL,
  2949. [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
  2950.  
  2951. # Save cache, so that ltconfig can load it
  2952. AC_CACHE_SAVE
  2953.  
  2954. # Actually configure libtool.  ac_aux_dir is where install-sh is found.
  2955. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
  2956. LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
  2957. LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
  2958. DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
  2959. ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
  2960. $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
  2961. || AC_MSG_ERROR([libtool configure failed])
  2962.  
  2963. # Reload cache, that may have been modified by ltconfig
  2964. AC_CACHE_LOAD
  2965.  
  2966. # This can be used to rebuild libtool when needed
  2967. LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
  2968.  
  2969. # Always use our own libtool.
  2970. LIBTOOL='$(SHELL) $(top_builddir)/libtool'
  2971. AC_SUBST(LIBTOOL)dnl
  2972.  
  2973. # Redirect the config.log output again, so that the ltconfig log is not
  2974. # clobbered by the next message.
  2975. exec 5>>./config.log
  2976. ])
  2977.  
  2978. AC_DEFUN(AC_LIBTOOL_SETUP,
  2979. [AC_PREREQ(2.13)dnl
  2980. AC_REQUIRE([AC_ENABLE_SHARED])dnl
  2981. AC_REQUIRE([AC_ENABLE_STATIC])dnl
  2982. AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
  2983. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  2984. AC_REQUIRE([AC_CANONICAL_BUILD])dnl
  2985. AC_REQUIRE([AC_PROG_RANLIB])dnl
  2986. AC_REQUIRE([AC_PROG_CC])dnl
  2987. AC_REQUIRE([AC_PROG_LD])dnl
  2988. AC_REQUIRE([AC_PROG_NM])dnl
  2989. AC_REQUIRE([AC_PROG_LN_S])dnl
  2990. dnl
  2991.  
  2992. # Check for any special flags to pass to ltconfig.
  2993. libtool_flags="--cache-file=$cache_file"
  2994. test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
  2995. test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
  2996. test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
  2997. test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
  2998. test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
  2999. ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
  3000. [libtool_flags="$libtool_flags --enable-dlopen"])
  3001. ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
  3002. [libtool_flags="$libtool_flags --enable-win32-dll"])
  3003. AC_ARG_ENABLE(libtool-lock,
  3004.   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
  3005. test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
  3006. test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
  3007.  
  3008. # Some flags need to be propagated to the compiler or linker for good
  3009. # libtool support.
  3010. case "$host" in
  3011. *-*-irix6*)
  3012.   # Find out which ABI we are using.
  3013.   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
  3014.   if AC_TRY_EVAL(ac_compile); then
  3015.     case "`/usr/bin/file conftest.o`" in
  3016.     *32-bit*)
  3017.       LD="${LD-ld} -32"
  3018.       ;;
  3019.     *N32*)
  3020.       LD="${LD-ld} -n32"
  3021.       ;;
  3022.     *64-bit*)
  3023.       LD="${LD-ld} -64"
  3024.       ;;
  3025.     esac
  3026.   fi
  3027.   rm -rf conftest*
  3028.   ;;
  3029.  
  3030. *-*-sco3.2v5*)
  3031.   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  3032.   SAVE_CFLAGS="$CFLAGS"
  3033.   CFLAGS="$CFLAGS -belf"
  3034.   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
  3035.     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
  3036.   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
  3037.     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
  3038.     CFLAGS="$SAVE_CFLAGS"
  3039.   fi
  3040.   ;;
  3041.  
  3042. ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
  3043. [*-*-cygwin* | *-*-mingw*)
  3044.   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
  3045.   AC_CHECK_TOOL(AS, as, false)
  3046.   AC_CHECK_TOOL(OBJDUMP, objdump, false)
  3047.   ;;
  3048. ])
  3049. esac
  3050. ])
  3051.  
  3052. # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
  3053. AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
  3054.  
  3055. # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
  3056. AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
  3057.  
  3058. # AC_ENABLE_SHARED - implement the --enable-shared flag
  3059. # Usage: AC_ENABLE_SHARED[(DEFAULT)]
  3060. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  3061. #   `yes'.
  3062. AC_DEFUN(AC_ENABLE_SHARED, [dnl
  3063. define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
  3064. AC_ARG_ENABLE(shared,
  3065. changequote(<<, >>)dnl
  3066. <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
  3067. changequote([, ])dnl
  3068. [p=${PACKAGE-default}
  3069. case "$enableval" in
  3070. yes) enable_shared=yes ;;
  3071. no) enable_shared=no ;;
  3072. *)
  3073.   enable_shared=no
  3074.   # Look at the argument we got.  We use all the common list separators.
  3075.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  3076.   for pkg in $enableval; do
  3077.     if test "X$pkg" = "X$p"; then
  3078.       enable_shared=yes
  3079.     fi
  3080.   done
  3081.   IFS="$ac_save_ifs"
  3082.   ;;
  3083. esac],
  3084. enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
  3085. ])
  3086.  
  3087. # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
  3088. AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  3089. AC_ENABLE_SHARED(no)])
  3090.  
  3091. # AC_ENABLE_STATIC - implement the --enable-static flag
  3092. # Usage: AC_ENABLE_STATIC[(DEFAULT)]
  3093. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  3094. #   `yes'.
  3095. AC_DEFUN(AC_ENABLE_STATIC, [dnl
  3096. define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
  3097. AC_ARG_ENABLE(static,
  3098. changequote(<<, >>)dnl
  3099. <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
  3100. changequote([, ])dnl
  3101. [p=${PACKAGE-default}
  3102. case "$enableval" in
  3103. yes) enable_static=yes ;;
  3104. no) enable_static=no ;;
  3105. *)
  3106.   enable_static=no
  3107.   # Look at the argument we got.  We use all the common list separators.
  3108.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  3109.   for pkg in $enableval; do
  3110.     if test "X$pkg" = "X$p"; then
  3111.       enable_static=yes
  3112.     fi
  3113.   done
  3114.   IFS="$ac_save_ifs"
  3115.   ;;
  3116. esac],
  3117. enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
  3118. ])
  3119.  
  3120. # AC_DISABLE_STATIC - set the default static flag to --disable-static
  3121. AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  3122. AC_ENABLE_STATIC(no)])
  3123.  
  3124.  
  3125. # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
  3126. # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
  3127. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  3128. #   `yes'.
  3129. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
  3130. define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
  3131. AC_ARG_ENABLE(fast-install,
  3132. changequote(<<, >>)dnl
  3133. <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
  3134. changequote([, ])dnl
  3135. [p=${PACKAGE-default}
  3136. case "$enableval" in
  3137. yes) enable_fast_install=yes ;;
  3138. no) enable_fast_install=no ;;
  3139. *)
  3140.   enable_fast_install=no
  3141.   # Look at the argument we got.  We use all the common list separators.
  3142.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  3143.   for pkg in $enableval; do
  3144.     if test "X$pkg" = "X$p"; then
  3145.       enable_fast_install=yes
  3146.     fi
  3147.   done
  3148.   IFS="$ac_save_ifs"
  3149.   ;;
  3150. esac],
  3151. enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
  3152. ])
  3153.  
  3154. # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
  3155. AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  3156. AC_ENABLE_FAST_INSTALL(no)])
  3157.  
  3158. # AC_PROG_LD - find the path to the GNU or non-GNU linker
  3159. AC_DEFUN(AC_PROG_LD,
  3160. [AC_ARG_WITH(gnu-ld,
  3161. [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
  3162. test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
  3163. AC_REQUIRE([AC_PROG_CC])dnl
  3164. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  3165. AC_REQUIRE([AC_CANONICAL_BUILD])dnl
  3166. ac_prog=ld
  3167. if test "$ac_cv_prog_gcc" = yes; then
  3168.   # Check if gcc -print-prog-name=ld gives a path.
  3169.   AC_MSG_CHECKING([for ld used by GCC])
  3170.   ac_prog=`($CC -print-prog-name=ld) 2>&5`
  3171.   case "$ac_prog" in
  3172.     # Accept absolute paths.
  3173. changequote(,)dnl
  3174.     [\\/]* | [A-Za-z]:[\\/]*)
  3175.       re_direlt='/[^/][^/]*/\.\./'
  3176. changequote([,])dnl
  3177.       # Canonicalize the path of ld
  3178.       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
  3179.       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
  3180.     ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
  3181.       done
  3182.       test -z "$LD" && LD="$ac_prog"
  3183.       ;;
  3184.   "")
  3185.     # If it fails, then pretend we aren't using GCC.
  3186.     ac_prog=ld
  3187.     ;;
  3188.   *)
  3189.     # If it is relative, then search for the first ld in PATH.
  3190.     with_gnu_ld=unknown
  3191.     ;;
  3192.   esac
  3193. elif test "$with_gnu_ld" = yes; then
  3194.   AC_MSG_CHECKING([for GNU ld])
  3195. else
  3196.   AC_MSG_CHECKING([for non-GNU ld])
  3197. fi
  3198. AC_CACHE_VAL(ac_cv_path_LD,
  3199. [if test -z "$LD"; then
  3200.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
  3201.   for ac_dir in $PATH; do
  3202.     test -z "$ac_dir" && ac_dir=.
  3203.     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
  3204.       ac_cv_path_LD="$ac_dir/$ac_prog"
  3205.       # Check to see if the program is GNU ld.  I'd rather use --version,
  3206.       # but apparently some GNU ld's only accept -v.
  3207.       # Break only if it was the GNU/non-GNU ld that we prefer.
  3208.       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
  3209.     test "$with_gnu_ld" != no && break
  3210.       else
  3211.     test "$with_gnu_ld" != yes && break
  3212.       fi
  3213.     fi
  3214.   done
  3215.   IFS="$ac_save_ifs"
  3216. else
  3217.   ac_cv_path_LD="$LD" # Let the user override the test with a path.
  3218. fi])
  3219. LD="$ac_cv_path_LD"
  3220. if test -n "$LD"; then
  3221.   AC_MSG_RESULT($LD)
  3222. else
  3223.   AC_MSG_RESULT(no)
  3224. fi
  3225. test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
  3226. AC_SUBST(LD)
  3227. AC_PROG_LD_GNU
  3228. ])
  3229.  
  3230. AC_DEFUN(AC_PROG_LD_GNU,
  3231. [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
  3232. [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
  3233. if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
  3234.   ac_cv_prog_gnu_ld=yes
  3235. else
  3236.   ac_cv_prog_gnu_ld=no
  3237. fi])
  3238. ])
  3239.  
  3240. # AC_PROG_NM - find the path to a BSD-compatible name lister
  3241. AC_DEFUN(AC_PROG_NM,
  3242. [AC_MSG_CHECKING([for BSD-compatible nm])
  3243. AC_CACHE_VAL(ac_cv_path_NM,
  3244. [if test -n "$NM"; then
  3245.   # Let the user override the test.
  3246.   ac_cv_path_NM="$NM"
  3247. else
  3248.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
  3249.   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
  3250.     test -z "$ac_dir" && ac_dir=.
  3251.     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
  3252.       # Check to see if the nm accepts a BSD-compat flag.
  3253.       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
  3254.       #   nm: unknown option "B" ignored
  3255.       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
  3256.     ac_cv_path_NM="$ac_dir/nm -B"
  3257.     break
  3258.       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
  3259.     ac_cv_path_NM="$ac_dir/nm -p"
  3260.     break
  3261.       else
  3262.     ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
  3263.     continue # so that we can try to find one that supports BSD flags
  3264.       fi
  3265.     fi
  3266.   done
  3267.   IFS="$ac_save_ifs"
  3268.   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
  3269. fi])
  3270. NM="$ac_cv_path_NM"
  3271. AC_MSG_RESULT([$NM])
  3272. AC_SUBST(NM)
  3273. ])
  3274.  
  3275. # AC_CHECK_LIBM - check for math library
  3276. AC_DEFUN(AC_CHECK_LIBM,
  3277. [AC_REQUIRE([AC_CANONICAL_HOST])dnl
  3278. LIBM=
  3279. case "$host" in
  3280. *-*-beos* | *-*-cygwin*)
  3281.   # These system don't have libm
  3282.   ;;
  3283. *-ncr-sysv4.3*)
  3284.   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
  3285.   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
  3286.   ;;
  3287. *)
  3288.   AC_CHECK_LIB(m, main, LIBM="-lm")
  3289.   ;;
  3290. esac
  3291. ])
  3292.  
  3293. # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
  3294. # the libltdl convenience library, adds --enable-ltdl-convenience to
  3295. # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
  3296. # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
  3297. # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
  3298. # '${top_builddir}/' (note the single quotes!) if your package is not
  3299. # flat, and, if you're not using automake, define top_builddir as
  3300. # appropriate in the Makefiles.
  3301. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  3302.   case "$enable_ltdl_convenience" in
  3303.   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
  3304.   "") enable_ltdl_convenience=yes
  3305.       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
  3306.   esac
  3307.   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
  3308. ])
  3309.  
  3310. # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
  3311. # the libltdl installable library, and adds --enable-ltdl-install to
  3312. # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
  3313. # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
  3314. # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
  3315. # '${top_builddir}/' (note the single quotes!) if your package is not
  3316. # flat, and, if you're not using automake, define top_builddir as
  3317. # appropriate in the Makefiles.
  3318. # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
  3319. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  3320.   AC_CHECK_LIB(ltdl, main,
  3321.   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
  3322.   [if test x"$enable_ltdl_install" = xno; then
  3323.      AC_MSG_WARN([libltdl not installed, but installation disabled])
  3324.    else
  3325.      enable_ltdl_install=yes
  3326.    fi
  3327.   ])
  3328.   if test x"$enable_ltdl_install" = x"yes"; then
  3329.     ac_configure_args="$ac_configure_args --enable-ltdl-install"
  3330.     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
  3331.   else
  3332.     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
  3333.     LIBLTDL="-lltdl"
  3334.   fi
  3335. ])
  3336.  
  3337. dnl old names
  3338. AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
  3339. AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
  3340. AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
  3341. AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
  3342. AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
  3343. AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
  3344. AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
  3345.  
  3346. dnl This is just to silence aclocal about the macro not being used
  3347. ifelse([AC_DISABLE_FAST_INSTALL])dnl
  3348.